[llvm] [InstCombine] Fold converted urem to 0 if there's no overlapping bits (PR #71528)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 07:39:59 PST 2023


================
@@ -36,12 +36,7 @@ define i64 @f1() #0 {
 ; CHECK-LABEL: define i64 @f1
 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
-; CHECK-NEXT:    [[TMP1:%.*]] = shl nuw nsw i64 [[TMP0]], 4
-; CHECK-NEXT:    [[TMP2:%.*]] = shl nuw nsw i64 [[TMP0]], 3
-; CHECK-NEXT:    [[TMP3:%.*]] = add nsw i64 [[TMP2]], -1
-; CHECK-NEXT:    [[REM:%.*]] = and i64 [[TMP1]], [[TMP3]]
-; CHECK-NEXT:    ret i64 [[REM]]
+; CHECK-NEXT:    ret i64 0
 ;
 entry:
   %0 = call i64 @llvm.vscale.i64()
----------------
dtcxzyw wrote:

Please drop unused `nsw/nuw` flags in the following `shl/add` insts.


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


More information about the llvm-commits mailing list