[llvm] [Analysis] Use usub_sat during SCEV expansion in some cases (PR #216975)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 05:02:37 PDT 2026


================
@@ -131,8 +131,7 @@ exit:
 define i32 @test1(ptr %array, i32 %length, i32 %n) #0 {
 ; CHECK-V8M-LABEL: @test1(
 ; CHECK-V8M-NEXT:  loop.preheader:
-; CHECK-V8M-NEXT:    [[UMAX:%.*]] = call i32 @llvm.umax.i32(i32 [[N:%.*]], i32 1)
-; CHECK-V8M-NEXT:    [[TMP0:%.*]] = add i32 [[UMAX]], -1
+; CHECK-V8M-NEXT:    [[TMP0:%.*]] = call i32 @llvm.usub.sat.i32(i32 [[N:%.*]], i32 1)
----------------
david-arm wrote:

See `@scev_usub_sat_n_2`, exposed via running the LLVM test suite

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


More information about the llvm-commits mailing list