llvm-project/llvm/lib/Transforms/InstCombine
Sanjay Patel 66f7fdb300 [InstCombine] fold lshr (sext X), C1 --> zext (lshr X, C2)
This was discussed in D33338. We have larger pattern-matching ending in a truncate that 
we can reduce or remove by handling these smaller patterns first. Further motivation is 
that narrower shift ops are easier for value tracking and zext is better than sext.

http://rise4fun.com/Alive/rhh

Name: boolshift
%sext = sext i1 %x to i8
%r = lshr i8 %sext, 7

=>

%r = zext i1 %x to i8

Name: noboolshift
%sext = sext i3 %x to i8
%r = lshr i8 %sext, 7

=>

%sh = lshr i3 %x, 2
%r = zext i3 %sh to i8

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

llvm-svn: 304939
2017-06-07 20:32:08 +00:00
..
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
InstCombineAddSub.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineAndOrXor.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineCalls.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineCasts.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineCompares.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineInternal.h Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
InstCombineLoadStoreAlloca.cpp [ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits. 2017-05-15 06:39:41 +00:00
InstCombineMulDivRem.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombinePHI.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
InstCombineSelect.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineShifts.cpp [InstCombine] fold lshr (sext X), C1 --> zext (lshr X, C2) 2017-06-07 20:32:08 +00:00
InstCombineSimplifyDemanded.cpp [InstCombine][InstSimplify] Use APInt::isNullValue/isOneValue to reduce compiled code for comparing APInts with 0 and 1. NFC 2017-06-07 07:40:37 +00:00
InstCombineVectorOps.cpp [InstCombine] Fix extractelement use before def 2017-06-05 09:18:10 +00:00
InstructionCombining.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
LLVMBuild.txt