[llvm] 3bfe096 - [ConstFold] Add another icmp of gep of global test (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 28 05:29:14 PST 2021
Author: Nikita Popov
Date: 2021-12-28T14:28:28+01:00
New Revision: 3bfe0962bac6147a34aa5d2dc7b6cd4968ac975a
URL: https://github.com/llvm/llvm-project/commit/3bfe0962bac6147a34aa5d2dc7b6cd4968ac975a
DIFF: https://github.com/llvm/llvm-project/commit/3bfe0962bac6147a34aa5d2dc7b6cd4968ac975a.diff
LOG: [ConstFold] Add another icmp of gep of global test (NFC)
This time with some complex arithmetic involving bitcasts.
Added:
Modified:
llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll b/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
index ee33201a8a22..d22317a18924 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/icmp-global.ll
@@ -236,3 +236,16 @@ define i1 @global_gep_sgt_global_gep() {
%cmp = icmp sgt i32* %gep2, %gep1
ret i1 %cmp
}
+
+define i1 @global_gep_ugt_global_gep_complex() {
+; CHECK-LABEL: @global_gep_ugt_global_gep_complex(
+; CHECK-NEXT: ret i1 icmp ugt (i32* bitcast (i8* getelementptr inbounds (i8, i8* bitcast ([2 x i32]* @g to i8*), i64 2) to i32*), i32* getelementptr inbounds ([2 x i32], [2 x i32]* @g, i64 0, i64 0))
+;
+ %gep1 = getelementptr inbounds [2 x i32], [2 x i32]* @g, i64 0, i64 0
+ %gep2 = getelementptr inbounds [2 x i32], [2 x i32]* @g, i64 0, i64 0
+ %gep2.cast = bitcast i32* %gep2 to i8*
+ %gep3 = getelementptr inbounds i8, i8* %gep2.cast, i64 2
+ %gep3.cast = bitcast i8* %gep3 to i32*
+ %cmp = icmp ugt i32* %gep3.cast, %gep1
+ ret i1 %cmp
+}
More information about the llvm-commits
mailing list