[llvm] [SCEV] Check AR's wrap flags when expanding. (PR #77827)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 06:18:46 PST 2024


================
@@ -22,7 +22,7 @@ define i32 @test() {
 ; CHECK-NEXT:    [[IV_2:%.*]] = phi i32 [ [[LSR_IV_NEXT2_LCSSA]], [[LOOP_2_PH]] ], [ [[IV_2_NEXT:%.*]], [[LOOP_2]] ]
 ; CHECK-NEXT:    call void @use(i32 [[IV_2]])
 ; CHECK-NEXT:    [[IV_2_NEXT]] = add i32 [[IV_2]], 1
-; CHECK-NEXT:    [[LSR_IV_NEXT]] = add nsw i64 [[LSR_IV]], -1
+; CHECK-NEXT:    [[LSR_IV_NEXT]] = add nuw nsw i64 [[LSR_IV]], -1
----------------
nikic wrote:

This change looks suspicious. We have initial value 1 and then add -1 with nuw. But this is before a "br i1 false", so it's fine -- just not sure whether it's correct for the right reasons.

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


More information about the llvm-commits mailing list