llvm-project/llvm/lib/Transforms/InstCombine
Craig Topper 924f20262b [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions
This patch teaches decomposeBitTestICmp to look through truncate instructions on the input to the compare. If a truncate is found it will now return the pre-truncated Value and appropriately extend the APInt mask.

This allows some code to be removed from InstSimplify that was doing this functionality.

This allows InstCombine's bit test combining code to match a pre-truncate Value with the same Value appear with an 'and' on another icmp. Or it allows us to combine a truncate to i16 and a truncate to i8. This also required removing the type check from the beginning of getMaskedTypeForICmpPair, but I believe that's ok because we still have to find two values from the input to each icmp that are equal before we'll do any transformation. So the type check was really just serving as an early out.

There was one user of decomposeBitTestICmp that didn't want to look through truncates, so I've added a flag to prevent that behavior when necessary.

Differential Revision: https://reviews.llvm.org/D37158

llvm-svn: 312382
2017-09-01 21:27:34 +00:00
..
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
InstCombineAddSub.cpp [InstCombine] Simplify pointer difference subtractions (GEP-GEP) where GEPs have other uses and one non-constant index 2017-07-27 18:27:11 +00:00
InstCombineAndOrXor.cpp [InstCombine] Don't require the compare types to be the same in getMaskedTypeForICmpPair. 2017-09-01 21:27:31 +00:00
InstCombineCalls.cpp [X86][InstCombine] Add some simplifications for BZHI intrinsics 2017-07-31 18:52:15 +00:00
InstCombineCasts.cpp [InstCombine] Support vector splats in transformZExtICmp 2017-08-29 18:58:13 +00:00
InstCombineCompares.cpp [InstCombine] Remove unused argument. NFC 2017-08-23 05:46:09 +00:00
InstCombineInternal.h [InstCombine] Remove unused argument. NFC 2017-08-23 05:46:09 +00:00
InstCombineLoadStoreAlloca.cpp Fix DebugLoc propagation for unreachable LoadInst 2017-07-19 01:27:24 +00:00
InstCombineMulDivRem.cpp [InstCombine] fix and enhance udiv/urem narrowing 2017-08-24 22:54:01 +00:00
InstCombinePHI.cpp fix typos in comments; NFC 2017-07-11 06:04:59 +00:00
InstCombineSelect.cpp [InstCombine][InstSimplify] Teach decomposeBitTestICmp to look through truncate instructions 2017-09-01 21:27:34 +00:00
InstCombineShifts.cpp [InstCombine] Added support for (X >>s C) << C --> X & (-1 << C) 2017-08-15 19:33:14 +00:00
InstCombineSimplifyDemanded.cpp [InstCombine] improve demanded vector elements analysis of insertelement 2017-08-31 15:57:17 +00:00
InstCombineVectorOps.cpp [InstCombine] improve demanded vector elements analysis of insertelement 2017-08-31 15:57:17 +00:00
InstructionCombining.cpp [InstCombine] Fold branches with irrelevant conditions to a constant. 2017-08-23 09:14:37 +00:00
LLVMBuild.txt