summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-01-04 16:00:24 +0100
committerNikita Popov <npopov@redhat.com>2022-01-04 16:08:09 +0100
commit25448826dd4c1965be08fa38cc02de9551084262 (patch)
tree8b01527e9c21f5839210d78e24286d4133e596b7
parent875dd75e5ab45fc48d12cdbad4fc0aa228abe6b5 (diff)
downloadllvm-25448826dd4c1965be08fa38cc02de9551084262.tar.gz
[InstSimplify] Update test to make miscompile more obvious (NFC)
This is now testing (null + g3) != g3 and still coming up with "true" as the answer. The original case was a less obvious miscompile with index overflow involved.
-rw-r--r--llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll b/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
index 99f1a16c5427..cdf6be0e5243 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
@@ -66,6 +66,7 @@ define i1 @ult_constexpr_constexpr_one(i8* %x) {
@g = global [2 x i32] [i32 1, i32 2]
@g2 = global i32 0
@g2_weak = extern_weak global i32
+@g3 = global i8 0
define i1 @global_ne_null() {
; CHECK-LABEL: @global_ne_null(
@@ -169,8 +170,8 @@ define i1 @null_gep_ne_global() {
; CHECK-LABEL: @null_gep_ne_global(
; CHECK-NEXT: ret i1 true
;
- %gep = getelementptr [2 x i32], [2 x i32]* null, i64 ptrtoint (i32* @g2 to i64)
- %cmp = icmp ne [2 x i32]* %gep, @g
+ %gep = getelementptr i8, i8* null, i64 ptrtoint (i8* @g3 to i64)
+ %cmp = icmp ne i8* %gep, @g3
ret i1 %cmp
}
@@ -178,8 +179,8 @@ define i1 @null_gep_ult_global() {
; CHECK-LABEL: @null_gep_ult_global(
; CHECK-NEXT: ret i1 true
;
- %gep = getelementptr [2 x i32], [2 x i32]* null, i64 ptrtoint (i32* @g2 to i64)
- %cmp = icmp ult [2 x i32]* %gep, @g
+ %gep = getelementptr i8, i8* null, i64 ptrtoint (i8* @g3 to i64)
+ %cmp = icmp ult i8* %gep, @g3
ret i1 %cmp
}