[llvm] [IndVarSimplify] [NFC] Fix incorrect test (PR #159683)
    Florian Mayer via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Sep 18 18:11:11 PDT 2025
    
    
  
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/159683
We would reenter the lloop with %i.04 being 0, so the usub would
overflow to -1. That does not appear to be the intent of the test.
>From bbcb10ada14b926b6bbd063025f450c676d0072b Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 18 Sep 2025 18:10:57 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
 .../Transforms/IndVarSimplify/X86/overflow-intrinsics.ll | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/overflow-intrinsics.ll b/llvm/test/Transforms/IndVarSimplify/X86/overflow-intrinsics.ll
index e678146c80af8..c7db8b962f3d6 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/overflow-intrinsics.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/overflow-intrinsics.ll
@@ -109,12 +109,9 @@ for.body:                                         ; preds = %entry, %cont
   %0 = tail call { i32, i1 } @llvm.usub.with.overflow.i32(i32 %i.04, i32 1)
   %1 = extractvalue { i32, i1 } %0, 1
 
-; It is theoretically possible to prove this, but SCEV cannot
-; represent non-unsigned-wrapping subtraction operations.
-
 ; CHECK: for.body:
-; CHECK:  [[COND:%[^ ]+]] = extractvalue { i32, i1 } %1, 1
-; CHECK-NEXT:  br i1 [[COND]], label %trap, label %cont, !nosanitize !0
+; CHECK-NOT: @llvm.usub.with.overflow.i32
+; CHECK: br i1 false, label %trap, label %cont, !nosanitize !0
   br i1 %1, label %trap, label %cont, !nosanitize !{}
 
 trap:                                             ; preds = %for.body
@@ -123,7 +120,7 @@ trap:                                             ; preds = %for.body
 
 cont:                                             ; preds = %for.body
   %2 = extractvalue { i32, i1 } %0, 0
-  %cmp = icmp sgt i32 %2, -1
+  %cmp = icmp sgt i32 %2, 0
   br i1 %cmp, label %for.body, label %for.cond.cleanup
 }
 
    
    
More information about the llvm-commits
mailing list