[llvm] 3cfb081 - [InstCombine] Add icmp gep tests without inbounds (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 02:41:35 PDT 2023
Author: Nikita Popov
Date: 2023-03-21T10:41:15+01:00
New Revision: 3cfb081c19f706adc4ea32998dca1ab4feae0b2b
URL: https://github.com/llvm/llvm-project/commit/3cfb081c19f706adc4ea32998dca1ab4feae0b2b
DIFF: https://github.com/llvm/llvm-project/commit/3cfb081c19f706adc4ea32998dca1ab4feae0b2b.diff
LOG: [InstCombine] Add icmp gep tests without inbounds (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp-gep.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp-gep.ll b/llvm/test/Transforms/InstCombine/icmp-gep.ll
index 1ccd3819e659..5fef7ac43536 100644
--- a/llvm/test/Transforms/InstCombine/icmp-gep.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-gep.ll
@@ -284,6 +284,32 @@ define i1 @test60(ptr %foo, i64 %i, i64 %j) {
ret i1 %cmp
}
+define i1 @test_gep_ult_no_inbounds(ptr %foo, i64 %i, i64 %j) {
+; CHECK-LABEL: @test_gep_ult_no_inbounds(
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i32, ptr [[FOO:%.*]], i64 [[I:%.*]]
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, ptr [[FOO]], i64 [[J:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[GEP1]], [[GEP2]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %gep1 = getelementptr i32, ptr %foo, i64 %i
+ %gep2 = getelementptr i8, ptr %foo, i64 %j
+ %cmp = icmp ult ptr %gep1, %gep2
+ ret i1 %cmp
+}
+
+define i1 @test_gep_eq_no_inbounds(ptr %foo, i64 %i, i64 %j) {
+; CHECK-LABEL: @test_gep_eq_no_inbounds(
+; CHECK-NEXT: [[GEP1:%.*]] = getelementptr i32, ptr [[FOO:%.*]], i64 [[I:%.*]]
+; CHECK-NEXT: [[GEP2:%.*]] = getelementptr i8, ptr [[FOO]], i64 [[J:%.*]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq ptr [[GEP1]], [[GEP2]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %gep1 = getelementptr i32, ptr %foo, i64 %i
+ %gep2 = getelementptr i8, ptr %foo, i64 %j
+ %cmp = icmp eq ptr %gep1, %gep2
+ ret i1 %cmp
+}
+
define i1 @test60_as1(ptr addrspace(1) %foo, i64 %i, i64 %j) {
; CHECK-LABEL: @test60_as1(
; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[I:%.*]] to i16
More information about the llvm-commits
mailing list