[llvm] ce09519 - [ConstraintElim] Add test with negative offset and NUW only GEP (NFC) (#203614)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 13:00:39 PDT 2026


Author: Florian Hahn
Date: 2026-06-12T22:00:34+02:00
New Revision: ce09519f40a6d76ec231ef8e4630c0d85c8cdaa5

URL: https://github.com/llvm/llvm-project/commit/ce09519f40a6d76ec231ef8e4630c0d85c8cdaa5
DIFF: https://github.com/llvm/llvm-project/commit/ce09519f40a6d76ec231ef8e4630c0d85c8cdaa5.diff

LOG: [ConstraintElim] Add test with negative offset and NUW only GEP (NFC) (#203614)

Add test currently mis-compiled with NUW only GEP.

https://alive2.llvm.org/ce/z/7G8uE3

Added: 
    

Modified: 
    llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll b/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll
index 6b185bc623813..28266857085bc 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps-unsigned-predicates.ll
@@ -649,3 +649,14 @@ trap:
 }
 
 declare void @use(i1)
+
+; FIXME: Currently incorrectly simplified to true.
+define i1 @gep_nuw_negative_offset_unsigned(ptr %p) {
+; CHECK-LABEL: @gep_nuw_negative_offset_unsigned(
+; CHECK-NEXT:    [[P2:%.*]] = getelementptr nuw i8, ptr [[P:%.*]], i64 -100
+; CHECK-NEXT:    ret i1 true
+;
+  %p2 = getelementptr nuw i8, ptr %p, i64 -100
+  %c = icmp ult ptr %p2, %p
+  ret i1 %c
+}


        


More information about the llvm-commits mailing list