[llvm] [InstCombine] Propagate NUW flags for `shl (lshr X, C1), C2 -> shl X, C2-C1` (PR #72525)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 07:48:18 PST 2023


================
@@ -5,8 +5,7 @@
 ; with nsw flag should also be non-negative
 define i1 @test_shift_nonnegative(i32 %a) {
 ; CHECK-LABEL: @test_shift_nonnegative(
-; CHECK-NEXT:    [[CMP:%.*]] = icmp sgt i32 [[A:%.*]], -1
-; CHECK-NEXT:    ret i1 [[CMP]]
+; CHECK-NEXT:    ret i1 true
----------------
dtcxzyw wrote:

Proof: https://alive2.llvm.org/ce/z/u9Z9LT

https://github.com/llvm/llvm-project/pull/72525


More information about the llvm-commits mailing list