llvm-6502/lib/Transforms/InstCombine
David Majnemer 505187a9bd InstCombine: Don't miscompile X % ((Pow2 << A) >>u B)
We assumed that A must be greater than B because the right hand side of
a remainder operator must be nonzero.

However, it is possible for A to be less than B if Pow2 is a power of
two greater than 1.

Take for example:
i32 %A = 0
i32 %B = 31
i32 Pow2 = 2147483648

((Pow2 << 0) >>u 31) is non-zero but A is less than B.

This fixes PR21274.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219713 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14 20:28:40 +00:00
..
CMakeLists.txt Tidy up a bit. No functional change. 2013-04-05 21:20:12 +00:00
InstCombine.h Revert "[InstCombine] re-commit r218721 with fix for pr21199" 2014-10-08 16:30:22 +00:00
InstCombineAddSub.cpp Format spacing and remove extra lines to comply with standards. NFC. 2014-10-08 08:37:49 +00:00
InstCombineAndOrXor.cpp InstCombine: Turn (x != 0 & x <u C) into the canonical range check form (x-1 <u C-1) 2014-10-12 14:02:34 +00:00
InstCombineCalls.cpp [InstCombine] Simplify the logic from r219067 using ValueTracking 2014-10-05 00:53:02 +00:00
InstCombineCasts.cpp Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
InstCombineCompares.cpp [InstCombine] Fix wrong folding of constant comparisons involving ashr and negative values. 2014-10-09 12:41:49 +00:00
InstCombineLoadStoreAlloca.cpp Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
InstCombineMulDivRem.cpp InstCombine: Don't miscompile X % ((Pow2 << A) >>u B) 2014-10-14 20:28:40 +00:00
InstCombinePHI.cpp Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
InstCombineSelect.cpp Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
InstCombineShifts.cpp Make use of @llvm.assume in ValueTracking (computeKnownBits, etc.) 2014-09-07 18:57:58 +00:00
InstCombineSimplifyDemanded.cpp Add additional patterns for @llvm.assume in ValueTracking 2014-09-07 19:21:07 +00:00
InstCombineVectorOps.cpp fixed some typos 2014-07-07 22:13:58 +00:00
InstCombineWorklist.h Canonicalize header guards into a common format. 2014-08-13 16:26:38 +00:00
InstructionCombining.cpp Revert "[InstCombine] re-commit r218721 with fix for pr21199" 2014-10-08 16:30:22 +00:00
LLVMBuild.txt
Makefile