From 25448826dd4c1965be08fa38cc02de9551084262 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 4 Jan 2022 16:00:24 +0100 Subject: [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. --- llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll | 9 +++++---- 1 file 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 } -- cgit v1.2.1