[PATCH] D61938: [InstCombine] canShiftBinOpWithConstantRHS(): drop bogus(?) signbit check

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 09:15:16 PDT 2019


spatel added a comment.

I don't see a reason for the constant limitation, but either way, we should have some minimal tests to verify (and change assuming this patch is committed):

  define i32 @or_ashr(i32 %x) {
    %b = or i32 %x, 2147483648 ; 0x80000000
    %r = ashr i32 %b, 8
    ret i32 %r
  }
  define i32 @xor_ashr(i32 %x) {
    %b = xor i32 %x, 2147483648 ; 0x80000000
    %r = ashr i32 %b, 8
    ret i32 %r
  }
  ; and with ashr is unreachable because it always get converted to lshr?

Also, add the related patterns with a 'select'?



================
Comment at: lib/Transforms/InstCombine/InstCombineShifts.cpp:319
+    return false;
+    break; // Do not perform transform!
   case Instruction::Add:
----------------
Remove unreachable 'break'.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61938/new/

https://reviews.llvm.org/D61938





More information about the llvm-commits mailing list