[PATCH] D19874: [InstSimplify] use computeKnownBits on shift amount operands

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 11:14:06 PDT 2016


spatel added inline comments.

================
Comment at: test/Transforms/InstSimplify/shift-knownbits.ll:142-144
@@ +141,5 @@
+define i1 @shl_i1(i1 %a, i1 %b) {
+; CHECK-LABEL: @shl_i1(
+; CHECK-NEXT:    [[SHL:%.*]] = shl i1 %a, %b
+; CHECK-NEXT:    ret i1 [[SHL]]
+;
----------------
majnemer wrote:
> Out of curiosity, isn't the result of the shl equivalent to %a?  %b cannot be as large as the bit width, 1.
Yes. The BitWidth check for '1' survived an earlier, buggy draft of this patch. Let me remove that; Log2_32_Ceil() gives us '0' for an input of '1', and that should work fine.


http://reviews.llvm.org/D19874





More information about the llvm-commits mailing list