llvm-6502/lib/Transforms/InstCombine
Chris Lattner b20c0b5092 Enhance the "compare with shift" and "compare with div"
optimizations to be much more aggressive in the face of
exact/nsw/nuw div and shifts.  For example, these (which
are the same except the first is 'exact' sdiv:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %A = sdiv exact i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %A = sdiv i64 %X, -5   ; X/-5 == 0 --> x == 0
  %B = icmp eq i64 %A, 0
  ret i1 %B
}

compile down to:

define i1 @sdiv_icmp4_exact(i64 %X) nounwind {
  %1 = icmp eq i64 %X, 0
  ret i1 %1
}

define i1 @sdiv_icmp4(i64 %X) nounwind {
  %X.off = add i64 %X, 4
  %1 = icmp ult i64 %X.off, 9
  ret i1 %1
}

This happens when you do something like:
  (ptr1-ptr2) == 42

where the pointers are pointers to non-unit types.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 05:23:05 +00:00
..
CMakeLists.txt Removed a bunch of unnecessary target_link_libraries. 2010-09-28 22:39:14 +00:00
InstCombine.h Call SimplifyFDivInst() in InstCombiner::visitFDiv(). 2011-01-29 17:50:27 +00:00
InstCombineAddSub.cpp A bunch of cleanups and simplifications using the new PatternMatch predicates 2011-02-10 05:14:58 +00:00
InstCombineAndOrXor.cpp more cleanups, notably bitcast isn't used for "signed to unsigned type 2011-02-10 05:17:27 +00:00
InstCombineCalls.cpp Teach instcombine about the rest of the SSE and SSE2 conversion 2011-01-10 07:19:37 +00:00
InstCombineCasts.cpp implement an instcombine xform that canonicalizes casts outside of and-with-constant operations. 2011-01-15 06:32:33 +00:00
InstCombineCompares.cpp Enhance the "compare with shift" and "compare with div" 2011-02-10 05:23:05 +00:00
InstCombineLoadStoreAlloca.cpp Move getOrEnforceKnownAlignment out of instcombine into Transforms/Utils. 2010-12-25 20:37:57 +00:00
InstCombineMulDivRem.cpp enhance vmcore to know that udiv's can be exact, and add a trivial 2011-02-06 21:44:57 +00:00
InstCombinePHI.cpp Teach InstructionSimplify about phi nodes. I chose to have it simply 2010-11-14 13:30:18 +00:00
InstCombineSelect.cpp Fold select + select where both selects are on the same condition. 2011-01-28 03:28:10 +00:00
InstCombineShifts.cpp Teach instsimplify some tricks about exact/nuw/nsw shifts. 2011-02-09 17:15:04 +00:00
InstCombineSimplifyDemanded.cpp teach SimplifyDemandedBits that exact shifts demand the bits they 2011-02-10 05:09:34 +00:00
InstCombineVectorOps.cpp PR5207: Rename overloaded APInt methods set(), clear(), flip() to 2010-12-01 08:53:58 +00:00
InstCombineWorklist.h I got tired of VISIBILITY_HIDDEN colliding with the gcc enum. Rename it 2010-05-11 20:16:09 +00:00
InstructionCombining.cpp Conservatively, clear optional flags, such as nsw, when performing 2011-02-02 02:05:46 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00