llvm-6502/lib
Jakob Stoklund Olesen 0d5fcae6cd Defer some shl transforms to DAGCombine.
The shl instruction is used to represent multiplication by a constant
power of two as well as bitwise left shifts. Some InstCombine
transformations would turn an shl instruction into a bit mask operation,
making it difficult for later analysis passes to recognize the
constsnt multiplication.

Disable those shl transformations, deferring them to DAGCombine time.
An 'shl X, C' instruction is now treated mostly the same was as 'mul X, C'.

These transformations are deferred:

  (X >>? C) << C   --> X & (-1 << C)  (When X >> C has multiple uses)
  (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C2)   (When C2 > C1)
  (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C2)  (When C1 > C2)

The corresponding exact transformations are preserved, just like
div-exact + mul:

  (X >>?,exact C) << C   --> X
  (X >>?,exact C1) << C2 --> X << (C2-C1)
  (X >>?,exact C1) << C2 --> X >>?,exact (C1-C2)

The disabled transformations could also prevent the instruction selector
from recognizing rotate patterns in hash functions and cryptographic
primitives. I have a test case for that, but it is too fragile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155136 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 16:46:26 +00:00
..
Analysis Revert "SCEV: When expanding a GEP the final addition to the base pointer has NUW but not NSW." 2012-04-17 06:33:57 +00:00
Archive Include cstdio in a few place that depended on getting it transitively through StringExtras.h 2012-03-23 11:35:30 +00:00
AsmParser Convert assert(0) to llvm_unreachable 2012-02-07 05:05:23 +00:00
Bitcode llvm::SwitchInst 2012-03-11 06:09:17 +00:00
CodeGen Allow targets to select the default scheduler by name. 2012-04-19 01:34:10 +00:00
DebugInfo Fix a C++11 UDL conflict. 2012-04-04 20:33:56 +00:00
ExecutionEngine Fix incorrect call of resolveRelocation() for ARM ELF stub relocations. 2012-04-17 20:10:16 +00:00
Linker It's possible for two types, which are isomorphic, to be added to the 2012-03-23 23:17:38 +00:00
MC MC assembly parser handling for trailing comma in macro instantiation. 2012-04-16 21:18:49 +00:00
Object Implement GDB integration for source level debugging of code JITed using 2012-04-16 22:12:58 +00:00
Support SourceMgr: Colorize diagnostics. 2012-04-18 19:04:15 +00:00
TableGen Fix copy/paste-o. 2012-04-18 18:09:53 +00:00
Target zap tabs 2012-04-19 15:16:31 +00:00
Transforms Defer some shl transforms to DAGCombine. 2012-04-19 16:46:26 +00:00
VMCore Remove AVX vpermil intrinsics. I removed their uses from clang headers and builtins a while back. 2012-04-18 05:24:00 +00:00
CMakeLists.txt Move TableGen's parser and entry point into a library 2011-10-01 16:41:13 +00:00
LLVMBuild.txt LLVMBuild: Introduce a common section which currently has a list of the 2011-12-12 22:45:54 +00:00
Makefile Remove more of llvmc and dependencies. 2011-09-20 00:34:27 +00:00