Skip to content
  • Sanjay Patel's avatar
    [InstCombine] fold lshr (sext X), C1 --> zext (lshr X, C2) · 66f7fdb3
    Sanjay Patel authored
    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
    66f7fdb3
Loading