[PATCH] D47428: [InstCombine] PR37603: low bit mask canonicalization
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 27 14:56:49 PDT 2018
lebedev.ri added inline comments.
================
Comment at: test/Transforms/InstCombine/set-lowbits-mask-canonicalize.ll:20-21
; CHECK-LABEL: @shl_add(
-; CHECK-NEXT: [[SETBIT:%.*]] = shl i32 1, [[NBITS:%.*]]
-; CHECK-NEXT: [[RET:%.*]] = add i32 [[SETBIT]], -1
+; CHECK-NEXT: [[TMP1:%.*]] = shl nsw i32 -1, [[NBITS:%.*]]
+; CHECK-NEXT: [[RET:%.*]] = xor i32 [[TMP1]], -1
; CHECK-NEXT: ret i32 [[RET]]
----------------
Note: i'm not *sure* we want to go //this// way.
Maybe we want to canonicalize the other way around?
(Another unrelated question could be,
do we want to "canonicalize" //all// `add nuw i32 %val, -1` to `xor i32 %val, -1`?
I'm not sure here, because we can't go from `not` to `dec` [[ https://rise4fun.com/Alive/36f | as per alive ]],
and the latter does not produce [[ https://godbolt.org/g/nvvZxX | lea ]])
Repository:
rL LLVM
https://reviews.llvm.org/D47428
More information about the llvm-commits
mailing list