[llvm] [SCEV] Rework wrap-flag-inference in zext-addrec (PR #217405)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 11:20:44 PDT 2026


================
@@ -180,13 +180,14 @@ exit:
 define void @sext_add_noflags(ptr %A, i32 %offset, i32 %M) {
 ; CHECK-LABEL: @sext_add_noflags(
 ; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[TMP0:%.*]] = zext i32 [[OFFSET:%.*]] to i64
 ; CHECK-NEXT:    [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[M:%.*]], i32 1)
 ; CHECK-NEXT:    [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[SMAX]] to i64
 ; CHECK-NEXT:    br label [[FOR_BODY:%.*]]
 ; CHECK:       for.body:
 ; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
-; CHECK-NEXT:    [[TMP0:%.*]] = trunc nuw nsw i64 [[INDVARS_IV]] to i32
-; CHECK-NEXT:    [[ADD_US:%.*]] = add i32 [[TMP0]], [[OFFSET:%.*]]
+; CHECK-NEXT:    [[TMP1:%.*]] = add nuw nsw i64 [[INDVARS_IV]], [[TMP0]]
----------------
artagnon wrote:

Was trying an experiment, thanks for checking: the stage2 build failed, failing the experiment. I've removed the commit on top.

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


More information about the llvm-commits mailing list