[llvm] 34e477e - [ConstraintElim] Convert tests to use opaque pointers (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 24 13:48:56 PST 2022
Author: Florian Hahn
Date: 2022-12-24T21:46:46Z
New Revision: 34e477e9dafd388a0df85929822fd7a475c8502c
URL: https://github.com/llvm/llvm-project/commit/34e477e9dafd388a0df85929822fd7a475c8502c
DIFF: https://github.com/llvm/llvm-project/commit/34e477e9dafd388a0df85929822fd7a475c8502c.diff
LOG: [ConstraintElim] Convert tests to use opaque pointers (NFC).
Added:
Modified:
llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices-signed-predicates.ll
llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll
llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll
llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition.ll
llvm/test/Transforms/ConstraintElimination/geps-precondition-overflow-check.ll
llvm/test/Transforms/ConstraintElimination/loops.ll
llvm/test/Transforms/ConstraintElimination/mixed.ll
llvm/test/Transforms/ConstraintElimination/pointercast.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices-signed-predicates.ll b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices-signed-predicates.ll
index 12496b697732e..df7eb6d83ef0f 100644
--- a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices-signed-predicates.ll
+++ b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices-signed-predicates.ll
@@ -124,8 +124,8 @@ define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_all_inbounds_overflo
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 6
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp slt i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp slt ptr %gep.1, %upper
ret i1 %c
}
@@ -142,7 +142,7 @@ entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
%gep.1 = getelementptr i32, ptr %dst.0, i64 1
- %c = icmp slt i32* %gep.1, %upper
+ %c = icmp slt ptr %gep.1, %upper
ret i1 %c
}
@@ -159,7 +159,7 @@ entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
%gep.1 = getelementptr i32, ptr %dst.0, i64 1
- %c = icmp slt i32* %gep.1, %upper
+ %c = icmp slt ptr %gep.1, %upper
ret i1 %c
}
@@ -175,8 +175,8 @@ define i1 @test_inner_gep_multiple_indices_ult_false_inc_gep_not_inbounds(ptr %d
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp slt i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp slt ptr %gep.1, %upper
ret i1 %c
}
@@ -192,8 +192,8 @@ define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds_overflo
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 5
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp slt i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp slt ptr %gep.1, %upper
ret i1 %c
}
diff --git a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll
index ef899c5c8282a..1eb4bf0d4b719 100644
--- a/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll
+++ b/llvm/test/Transforms/ConstraintElimination/gep-add-multiple-indices.ll
@@ -124,8 +124,8 @@ define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_all_inbounds_overflo
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 6
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp ult i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp ult ptr %gep.1, %upper
ret i1 %c
}
@@ -142,7 +142,7 @@ entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
%gep.1 = getelementptr i32, ptr %dst.0, i64 1
- %c = icmp ult i32* %gep.1, %upper
+ %c = icmp ult ptr %gep.1, %upper
ret i1 %c
}
@@ -159,7 +159,7 @@ entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
%gep.1 = getelementptr i32, ptr %dst.0, i64 1
- %c = icmp ult i32* %gep.1, %upper
+ %c = icmp ult ptr %gep.1, %upper
ret i1 %c
}
@@ -175,8 +175,8 @@ define i1 @test_inner_gep_multiple_indices_ult_false_inc_gep_not_inbounds(ptr %d
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 2
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp ult i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp ult ptr %gep.1, %upper
ret i1 %c
}
@@ -192,8 +192,8 @@ define i1 @test_inner_gep_multiple_indices_ult_true_inc_gep_not_inbounds_overflo
entry:
%dst.0 = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 0
%upper = getelementptr inbounds [2 x i32], ptr %dst, i64 0, i64 5
- %gep.1 = getelementptr i32, i32* %dst.0, i64 2
- %c = icmp ult i32* %gep.1, %upper
+ %gep.1 = getelementptr i32, ptr %dst.0, i64 2
+ %c = icmp ult ptr %gep.1, %upper
ret i1 %c
}
diff --git a/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll b/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll
index e7ea234591cae..7bd2aca816026 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition-ub-in-use-blocks.ll
@@ -3,80 +3,80 @@
; Tests for using inbounds information from GEPs where the GEP only causes UB in the use blocks.
-declare void @noundef(i32* noundef) willreturn nounwind
-declare void @noundef2(i32* noundef)
+declare void @noundef(ptr noundef) willreturn nounwind
+declare void @noundef2(ptr noundef)
declare void @use(i1)
; %start + %n.ext is guaranteed to not overflow (due to inbounds).
; %start + %idx.ext does not overflow if %idx.ext <= %n.ext.
-define i1 @inbounds_poison_is_ub_in_use_block_1(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_is_ub_in_use_block_1(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_is_ub_in_use_block_1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- call void @noundef(i32* %upper)
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ call void @noundef(ptr %upper)
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
-define i1 @inbounds_poison_is_ub_in_use_block_2(i32* %src, i32 %n, i32 %idx, i1 %c) {
+define i1 @inbounds_poison_is_ub_in_use_block_2(ptr %src, i32 %n, i32 %idx, i1 %c) {
; CHECK-LABEL: @inbounds_poison_is_ub_in_use_block_2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
- call void @noundef(i32* %upper)
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
+ call void @noundef(ptr %upper)
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
@@ -84,198 +84,198 @@ declare void @llvm.assume(i1)
; %start + %n.ext is guaranteed to not overflow (due to inbounds).
; %start + %idx.ext does not overflow if %idx.ext <= %n.ext.
-define i1 @inbounds_poison_is_ub_in_use_block_by_assume(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_is_ub_in_use_block_by_assume(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_is_ub_in_use_block_by_assume(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_NE:%.*]] = icmp ule i32* null, [[UPPER]]
+; CHECK-NEXT: [[CMP_NE:%.*]] = icmp ule ptr null, [[UPPER]]
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_NE]])
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.ne = icmp ule i32* null, %upper
+ %cmp.ne = icmp ule ptr null, %upper
call void @llvm.assume(i1 %cmp.ne)
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
; %start + %n.ext is guaranteed to not overflow (due to inbounds).
; %start + %idx.ext does not overflow if %idx.ext <= %n.ext.
-define i1 @inbounds_poison_is_ub_in_in_multiple_use_blocks_1(i32* %src, i32 %n, i32 %idx, i1 %c) {
+define i1 @inbounds_poison_is_ub_in_in_multiple_use_blocks_1(ptr %src, i32 %n, i32 %idx, i1 %c) {
; CHECK-LABEL: @inbounds_poison_is_ub_in_in_multiple_use_blocks_1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: br i1 [[C:%.*]], label [[CHECK_BB:%.*]], label [[EXIT:%.*]]
; CHECK: check.bb:
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
; CHECK: exit:
; CHECK-NEXT: ret i1 false
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
br i1 %c, label %check.bb, label %exit
check.bb:
- call void @noundef(i32* %upper)
+ call void @noundef(ptr %upper)
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- call void @noundef(i32* %upper)
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ call void @noundef(ptr %upper)
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
exit:
ret i1 false
}
-define i1 @may_exit_before_ub_is_caused(i32* %src, i32 %n, i32 %idx) {
+define i1 @may_exit_before_ub_is_caused(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @may_exit_before_ub_is_caused(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: call void @use(i1 [[CMP_UPPER_1]])
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
call void @use(i1 %cmp.upper.1);
- call void @noundef(i32* %upper)
+ call void @noundef(ptr %upper)
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
-define i1 @only_UB_in_false_block(i32* %src, i32 %n, i32 %idx) {
+define i1 @only_UB_in_false_block(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @only_UB_in_false_block(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- call void @noundef(i32* %upper)
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ call void @noundef(ptr %upper)
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
-define i1 @only_ub_by_assume_in_false_block(i32* %src, i32 %n, i32 %idx) {
+define i1 @only_ub_by_assume_in_false_block(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @only_ub_by_assume_in_false_block(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_NE:%.*]] = icmp ule i32* null, [[UPPER]]
+; CHECK-NEXT: [[CMP_NE:%.*]] = icmp ule ptr null, [[UPPER]]
; CHECK-NEXT: call void @llvm.assume(i1 [[CMP_NE]])
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.ne = icmp ule i32* null, %upper
+ %cmp.ne = icmp ule ptr null, %upper
call void @llvm.assume(i1 %cmp.ne)
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
diff --git a/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition.ll b/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition.ll
index 06ec0dde40edf..e22317fb8c794 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps-inbounds-precondition.ll
@@ -3,89 +3,89 @@
; Tests for using inbounds information from GEPs.
-declare void @noundef(i32* noundef)
+declare void @noundef(ptr noundef)
-define i1 @inbounds_poison_is_ub1(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_is_ub1(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_is_ub1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 5
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 5
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N:%.*]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX_4:%.*]] = getelementptr i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[CMP_UPPER_4:%.*]] = icmp ule i32* [[SRC_IDX_4]], [[UPPER]]
-; CHECK-NEXT: [[SRC_IDX_5:%.*]] = getelementptr i32, i32* [[SRC]], i64 5
-; CHECK-NEXT: [[CMP_UPPER_5:%.*]] = icmp ule i32* [[SRC_IDX_5]], [[UPPER]]
+; CHECK-NEXT: [[SRC_IDX_4:%.*]] = getelementptr i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: [[CMP_UPPER_4:%.*]] = icmp ule ptr [[SRC_IDX_4]], [[UPPER]]
+; CHECK-NEXT: [[SRC_IDX_5:%.*]] = getelementptr i32, ptr [[SRC]], i64 5
+; CHECK-NEXT: [[CMP_UPPER_5:%.*]] = icmp ule ptr [[SRC_IDX_5]], [[UPPER]]
; CHECK-NEXT: [[RES_0:%.*]] = xor i1 [[CMP_UPPER_4]], [[CMP_UPPER_5]]
-; CHECK-NEXT: [[SRC_IDX_6:%.*]] = getelementptr i32, i32* [[SRC]], i64 6
-; CHECK-NEXT: [[CMP_UPPER_6:%.*]] = icmp ule i32* [[SRC_IDX_6]], [[UPPER]]
+; CHECK-NEXT: [[SRC_IDX_6:%.*]] = getelementptr i32, ptr [[SRC]], i64 6
+; CHECK-NEXT: [[CMP_UPPER_6:%.*]] = icmp ule ptr [[SRC_IDX_6]], [[UPPER]]
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[RES_0]], [[CMP_UPPER_6]]
-; CHECK-NEXT: [[SRC_IDX_NEG_1:%.*]] = getelementptr i32, i32* [[SRC]], i64 -1
-; CHECK-NEXT: [[CMP_UPPER_NEG_1:%.*]] = icmp ule i32* [[SRC_IDX_NEG_1]], [[UPPER]]
+; CHECK-NEXT: [[SRC_IDX_NEG_1:%.*]] = getelementptr i32, ptr [[SRC]], i64 -1
+; CHECK-NEXT: [[CMP_UPPER_NEG_1:%.*]] = icmp ule ptr [[SRC_IDX_NEG_1]], [[UPPER]]
; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[CMP_UPPER_NEG_1]]
; CHECK-NEXT: ret i1 [[RES_2]]
;
entry:
- %upper = getelementptr inbounds i32, i32* %src, i64 5
- call void @noundef(i32* %upper)
+ %upper = getelementptr inbounds i32, ptr %src, i64 5
+ call void @noundef(ptr %upper)
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx.4 = getelementptr i32, i32* %src, i64 4
- %cmp.upper.4 = icmp ule i32* %src.idx.4, %upper
- %src.idx.5 = getelementptr i32, i32* %src, i64 5
- %cmp.upper.5 = icmp ule i32* %src.idx.5, %upper
+ %src.idx.4 = getelementptr i32, ptr %src, i64 4
+ %cmp.upper.4 = icmp ule ptr %src.idx.4, %upper
+ %src.idx.5 = getelementptr i32, ptr %src, i64 5
+ %cmp.upper.5 = icmp ule ptr %src.idx.5, %upper
%res.0 = xor i1 %cmp.upper.4, %cmp.upper.5
- %src.idx.6 = getelementptr i32, i32* %src, i64 6
- %cmp.upper.6 = icmp ule i32* %src.idx.6, %upper
+ %src.idx.6 = getelementptr i32, ptr %src, i64 6
+ %cmp.upper.6 = icmp ule ptr %src.idx.6, %upper
%res.1 = xor i1 %res.0, %cmp.upper.6
- %src.idx.neg.1 = getelementptr i32, i32* %src, i64 -1
- %cmp.upper.neg.1 = icmp ule i32* %src.idx.neg.1, %upper
+ %src.idx.neg.1 = getelementptr i32, ptr %src, i64 -1
+ %cmp.upper.neg.1 = icmp ule ptr %src.idx.neg.1, %upper
%res.2 = xor i1 %res.1, %cmp.upper.neg.1
ret i1 %res.2
}
; %start + %n.ext is guaranteed to not overflow (due to inbounds).
; %start + %idx.ext does not overflow if %idx.ext <= %n.ext.
-define i1 @inbounds_poison_is_ub2(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_is_ub2(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_is_ub2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
- call void @noundef(i32* %upper)
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ call void @noundef(ptr %upper)
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
; Same as inbounds_poison_is_ub2, but with individual GEPs in the %then and
; %else blocks.
-define i1 @inbounds_poison_is_ub3(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_is_ub3(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_is_ub3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
@@ -93,16 +93,16 @@ define i1 @inbounds_poison_is_ub3(i32* %src, i32 %n, i32 %idx) {
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i64 [[IDX_EXT]], [[N_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_1]])
-; CHECK-NEXT: [[SRC_IDX_1:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX_1]], [[UPPER_1]]
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_1]])
+; CHECK-NEXT: [[SRC_IDX_1:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX_1]], [[UPPER_1]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[N_EXT]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_2]])
-; CHECK-NEXT: [[SRC_IDX_2:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX_2]], [[UPPER_2]]
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 [[N_EXT]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_2]])
+; CHECK-NEXT: [[SRC_IDX_2:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX_2]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
@@ -112,17 +112,17 @@ entry:
br i1 %cmp.idx, label %then, label %else
then:
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 %n.ext
- call void @noundef(i32* %upper.1)
- %src.idx.1 = getelementptr i32, i32* %src, i64 %idx.ext
- %cmp.upper.1 = icmp ule i32* %src.idx.1, %upper.1
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ call void @noundef(ptr %upper.1)
+ %src.idx.1 = getelementptr i32, ptr %src, i64 %idx.ext
+ %cmp.upper.1 = icmp ule ptr %src.idx.1, %upper.1
ret i1 %cmp.upper.1
else:
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 %n.ext
- call void @noundef(i32* %upper.2)
- %src.idx.2 = getelementptr i32, i32* %src, i64 %idx.ext
- %cmp.upper.2 = icmp ule i32* %src.idx.2, %upper.2
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ call void @noundef(ptr %upper.2)
+ %src.idx.2 = getelementptr i32, ptr %src, i64 %idx.ext
+ %cmp.upper.2 = icmp ule ptr %src.idx.2, %upper.2
ret i1 %cmp.upper.2
}
@@ -130,42 +130,42 @@ else:
; not simplify anything. In this particular case, the returned result will be
; poison in this case, so it could be simplified, but currently we cannot
; distinguish that case.
-define i1 @inbounds_poison_does_not_cause_ub(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_does_not_cause_ub(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_does_not_cause_ub(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i64 [[IDX_EXT]], [[N_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
%idx.ext = zext i32 %idx to i64
- %upper = getelementptr inbounds i32, i32* %src, i64 %n.ext
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %upper = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
%cmp.idx = icmp ult i64 %idx.ext, %n.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
; Same as @inbounds_poison_does_not_cause_ub, but with separate GEPs in the
; %then and %else blocks.
-define i1 @inbounds_poison_does_not_cause_ub2(i32* %src, i32 %n, i32 %idx) {
+define i1 @inbounds_poison_does_not_cause_ub2(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @inbounds_poison_does_not_cause_ub2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
@@ -173,14 +173,14 @@ define i1 @inbounds_poison_does_not_cause_ub2(i32* %src, i32 %n, i32 %idx) {
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i64 [[IDX_EXT]], [[N_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[SRC_IDX_1:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX_1]], [[UPPER_1]]
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[SRC_IDX_1:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX_1]], [[UPPER_1]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[SRC_IDX_2:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[N_EXT]]
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX_2]], [[UPPER_2]]
+; CHECK-NEXT: [[SRC_IDX_2:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 [[N_EXT]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX_2]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
@@ -190,155 +190,155 @@ entry:
br i1 %cmp.idx, label %then, label %else
then:
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 %n.ext
- %src.idx.1 = getelementptr i32, i32* %src, i64 %idx.ext
- %cmp.upper.1 = icmp ule i32* %src.idx.1, %upper.1
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ %src.idx.1 = getelementptr i32, ptr %src, i64 %idx.ext
+ %cmp.upper.1 = icmp ule ptr %src.idx.1, %upper.1
ret i1 %cmp.upper.1
else:
- %src.idx.2 = getelementptr i32, i32* %src, i64 %idx.ext
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 %n.ext
- %cmp.upper.2 = icmp ule i32* %src.idx.2, %upper.2
+ %src.idx.2 = getelementptr i32, ptr %src, i64 %idx.ext
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ %cmp.upper.2 = icmp ule ptr %src.idx.2, %upper.2
ret i1 %cmp.upper.2
}
-define i1 @no_zexts_indices_may_be_negative(i32* %src, i32 %n, i32 %idx) {
+define i1 @no_zexts_indices_may_be_negative(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @no_zexts_indices_may_be_negative(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i32 [[N:%.*]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER]])
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i32 [[IDX:%.*]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i32 [[N:%.*]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER]])
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i32 [[IDX:%.*]]
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX]], [[N]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
- %upper = getelementptr inbounds i32, i32* %src, i32 %n
- call void @noundef(i32* %upper)
- %src.idx = getelementptr i32, i32* %src, i32 %idx
+ %upper = getelementptr inbounds i32, ptr %src, i32 %n
+ call void @noundef(ptr %upper)
+ %src.idx = getelementptr i32, ptr %src, i32 %idx
%cmp.idx = icmp ult i32 %idx, %n
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper
ret i1 %cmp.upper.2
}
; Tests for multiple inbound GEPs, make sure the largest upper bound is used.
-define i1 @multiple_upper_bounds(i32* %src, i32 %n, i32 %idx) {
+define i1 @multiple_upper_bounds(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @multiple_upper_bounds(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 1
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_1]])
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 [[N_EXT]]
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_2]])
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 1
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_1]])
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 [[N_EXT]]
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_2]])
; CHECK-NEXT: [[CMP_IDX:%.*]] = icmp ult i32 [[IDX:%.*]], [[N]]
; CHECK-NEXT: [[IDX_EXT:%.*]] = zext i32 [[IDX]] to i64
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 [[IDX_EXT]]
; CHECK-NEXT: br i1 [[CMP_IDX]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER_2]]
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
; CHECK: else:
-; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER_2]]
+; CHECK-NEXT: [[CMP_UPPER_2:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_2]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 1
- call void @noundef(i32* %upper.1)
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 %n.ext
- call void @noundef(i32* %upper.2)
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 1
+ call void @noundef(ptr %upper.1)
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 %n.ext
+ call void @noundef(ptr %upper.2)
%cmp.idx = icmp ult i32 %idx, %n
%idx.ext = zext i32 %idx to i64
- %src.idx = getelementptr i32, i32* %src, i64 %idx.ext
+ %src.idx = getelementptr i32, ptr %src, i64 %idx.ext
br i1 %cmp.idx, label %then, label %else
then:
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper.2
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper.2
ret i1 %cmp.upper.1
else:
- %cmp.upper.2 = icmp ule i32* %src.idx, %upper.2
+ %cmp.upper.2 = icmp ule ptr %src.idx, %upper.2
ret i1 %cmp.upper.2
}
-define i1 @multiple_upper_bounds2(i32* %src, i32 %n, i32 %idx) {
+define i1 @multiple_upper_bounds2(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @multiple_upper_bounds2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 1
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_1]])
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_2]])
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER_2]]
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 1
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_1]])
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_2]])
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 1
- call void @noundef(i32* %upper.1)
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 4
- call void @noundef(i32* %upper.2)
- %src.idx = getelementptr i32, i32* %src, i64 4
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper.2
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 1
+ call void @noundef(ptr %upper.1)
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 4
+ call void @noundef(ptr %upper.2)
+ %src.idx = getelementptr i32, ptr %src, i64 4
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper.2
ret i1 %cmp.upper.1
}
-define i1 @multiple_upper_bounds3(i32* %src, i32 %n, i32 %idx) {
+define i1 @multiple_upper_bounds3(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @multiple_upper_bounds3(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 4
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_1]])
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 1
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_2]])
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER_1]]
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 4
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_1]])
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 1
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_2]])
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER_1]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 4
- call void @noundef(i32* %upper.1)
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 1
- call void @noundef(i32* %upper.2)
- %src.idx = getelementptr i32, i32* %src, i64 4
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper.1
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 4
+ call void @noundef(ptr %upper.1)
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 1
+ call void @noundef(ptr %upper.2)
+ %src.idx = getelementptr i32, ptr %src, i64 4
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper.1
ret i1 %cmp.upper.1
}
; %src.idx + 5 may overflow.
-define i1 @multiple_upper_bounds4(i32* %src, i32 %n, i32 %idx) {
+define i1 @multiple_upper_bounds4(ptr %src, i32 %n, i32 %idx) {
; CHECK-LABEL: @multiple_upper_bounds4(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, i32* [[SRC:%.*]], i64 1
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_1]])
-; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: call void @noundef(i32* [[UPPER_2]])
-; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, i32* [[SRC]], i64 5
-; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule i32* [[SRC_IDX]], [[UPPER_2]]
+; CHECK-NEXT: [[UPPER_1:%.*]] = getelementptr inbounds i32, ptr [[SRC:%.*]], i64 1
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_1]])
+; CHECK-NEXT: [[UPPER_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: call void @noundef(ptr [[UPPER_2]])
+; CHECK-NEXT: [[SRC_IDX:%.*]] = getelementptr i32, ptr [[SRC]], i64 5
+; CHECK-NEXT: [[CMP_UPPER_1:%.*]] = icmp ule ptr [[SRC_IDX]], [[UPPER_2]]
; CHECK-NEXT: ret i1 [[CMP_UPPER_1]]
;
entry:
%n.ext = zext i32 %n to i64
- %upper.1 = getelementptr inbounds i32, i32* %src, i64 1
- call void @noundef(i32* %upper.1)
- %upper.2 = getelementptr inbounds i32, i32* %src, i64 4
- call void @noundef(i32* %upper.2)
- %src.idx = getelementptr i32, i32* %src, i64 5
- %cmp.upper.1 = icmp ule i32* %src.idx, %upper.2
+ %upper.1 = getelementptr inbounds i32, ptr %src, i64 1
+ call void @noundef(ptr %upper.1)
+ %upper.2 = getelementptr inbounds i32, ptr %src, i64 4
+ call void @noundef(ptr %upper.2)
+ %src.idx = getelementptr i32, ptr %src, i64 5
+ %cmp.upper.1 = icmp ule ptr %src.idx, %upper.2
ret i1 %cmp.upper.1
}
diff --git a/llvm/test/Transforms/ConstraintElimination/geps-precondition-overflow-check.ll b/llvm/test/Transforms/ConstraintElimination/geps-precondition-overflow-check.ll
index 13f96119f691a..d8441a5424a45 100644
--- a/llvm/test/Transforms/ConstraintElimination/geps-precondition-overflow-check.ll
+++ b/llvm/test/Transforms/ConstraintElimination/geps-precondition-overflow-check.ll
@@ -4,192 +4,192 @@
; Tests for cases with explicit checks that %ptr + x >= %ptr. The information can
; be used to determine that certain GEPs do not overflow.
-define i1 @overflow_check_1(i32* %dst) {
+define i1 @overflow_check_1(ptr %dst) {
; CHECK-LABEL: @overflow_check_1(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 5
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 5
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: br i1 [[DST_5_UGE]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: ret i1 [[TRUE_DST_4_UGE]]
; CHECK: else:
; CHECK-NEXT: ret i1 false
;
entry:
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
br i1 %dst.5.uge, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %true.dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %true.dst.4.uge = icmp uge ptr %dst.4, %dst
ret i1 %true.dst.4.uge
else:
ret i1 0
}
-define i1 @overflow_check_2_and(i32* %dst) {
+define i1 @overflow_check_2_and(ptr %dst) {
; CHECK-LABEL: @overflow_check_2_and(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 5
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 5
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[AND:%.*]] = and i1 [[DST_5_UGE]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: ret i1 [[TRUE_DST_4_UGE]]
; CHECK: else:
; CHECK-NEXT: ret i1 true
;
entry:
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%and = and i1 %dst.5.uge, %dst.5.uge
br i1 %and, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %true.dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %true.dst.4.uge = icmp uge ptr %dst.4, %dst
ret i1 %true.dst.4.uge
else:
ret i1 true
}
-define i1 @overflow_check_3_and(i32* %dst) {
+define i1 @overflow_check_3_and(ptr %dst) {
; CHECK-LABEL: @overflow_check_3_and(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 5
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 5
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[AND:%.*]] = and i1 [[DST_5_UGE]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: ret i1 [[DST_4_UGE]]
; CHECK: else:
-; CHECK-NEXT: [[ELSE_DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[ELSE_DST_4_UGE:%.*]] = icmp uge i32* [[ELSE_DST_4]], [[DST]]
+; CHECK-NEXT: [[ELSE_DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[ELSE_DST_4_UGE:%.*]] = icmp uge ptr [[ELSE_DST_4]], [[DST]]
; CHECK-NEXT: ret i1 [[ELSE_DST_4_UGE]]
;
entry:
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%and = and i1 %dst.5.uge, %dst.5.uge
br i1 %and, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %dst.4.uge = icmp uge ptr %dst.4, %dst
ret i1 %dst.4.uge
else:
- %else.dst.4 = getelementptr i32, i32* %dst, i64 4
- %else.dst.4.uge = icmp uge i32* %else.dst.4, %dst
+ %else.dst.4 = getelementptr i32, ptr %dst, i64 4
+ %else.dst.4.uge = icmp uge ptr %else.dst.4, %dst
ret i1 %else.dst.4.uge
}
-define i1 @overflow_check_4_and(i32* %dst) {
+define i1 @overflow_check_4_and(ptr %dst) {
; CHECK-LABEL: @overflow_check_4_and(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 5
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 5
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[AND:%.*]] = and i1 [[DST_5_UGE]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
-; CHECK-NEXT: [[DST_5_2:%.*]] = getelementptr i32, i32* [[DST]], i64 5
-; CHECK-NEXT: [[TRUE_DST_5_UGE:%.*]] = icmp uge i32* [[DST_5_2]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_5_2:%.*]] = getelementptr i32, ptr [[DST]], i64 5
+; CHECK-NEXT: [[TRUE_DST_5_UGE:%.*]] = icmp uge ptr [[DST_5_2]], [[DST]]
; CHECK-NEXT: [[RES_0:%.*]] = xor i1 [[TRUE_DST_4_UGE]], [[TRUE_DST_5_UGE]]
-; CHECK-NEXT: [[DST_6:%.*]] = getelementptr i32, i32* [[DST]], i64 6
-; CHECK-NEXT: [[C_DST_6_UGE:%.*]] = icmp uge i32* [[DST_6]], [[DST]]
+; CHECK-NEXT: [[DST_6:%.*]] = getelementptr i32, ptr [[DST]], i64 6
+; CHECK-NEXT: [[C_DST_6_UGE:%.*]] = icmp uge ptr [[DST_6]], [[DST]]
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[RES_0]], [[C_DST_6_UGE]]
; CHECK-NEXT: ret i1 [[RES_1]]
; CHECK: else:
-; CHECK-NEXT: [[ELSE_DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[ELSE_DST_4_UGE:%.*]] = icmp uge i32* [[ELSE_DST_4]], [[DST]]
-; CHECK-NEXT: [[ELSE_DST_6:%.*]] = getelementptr i32, i32* [[DST]], i64 6
-; CHECK-NEXT: [[ELSE_DST_6_UGE:%.*]] = icmp uge i32* [[ELSE_DST_6]], [[DST]]
+; CHECK-NEXT: [[ELSE_DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[ELSE_DST_4_UGE:%.*]] = icmp uge ptr [[ELSE_DST_4]], [[DST]]
+; CHECK-NEXT: [[ELSE_DST_6:%.*]] = getelementptr i32, ptr [[DST]], i64 6
+; CHECK-NEXT: [[ELSE_DST_6_UGE:%.*]] = icmp uge ptr [[ELSE_DST_6]], [[DST]]
; CHECK-NEXT: [[ELSE_RES_0:%.*]] = xor i1 [[ELSE_DST_4_UGE]], [[ELSE_DST_6_UGE]]
; CHECK-NEXT: ret i1 [[ELSE_RES_0]]
;
entry:
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%and = and i1 %dst.5.uge, %dst.5.uge
br i1 %and, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %true.dst.4.uge = icmp uge i32* %dst.4, %dst
- %dst.5.2 = getelementptr i32, i32* %dst, i64 5
- %true.dst.5.uge = icmp uge i32* %dst.5.2, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %true.dst.4.uge = icmp uge ptr %dst.4, %dst
+ %dst.5.2 = getelementptr i32, ptr %dst, i64 5
+ %true.dst.5.uge = icmp uge ptr %dst.5.2, %dst
%res.0 = xor i1 %true.dst.4.uge, %true.dst.5.uge
- %dst.6 = getelementptr i32, i32* %dst, i64 6
- %c.dst.6.uge = icmp uge i32* %dst.6, %dst
+ %dst.6 = getelementptr i32, ptr %dst, i64 6
+ %c.dst.6.uge = icmp uge ptr %dst.6, %dst
%res.1 = xor i1 %res.0, %c.dst.6.uge
ret i1 %res.1
else:
- %else.dst.4 = getelementptr i32, i32* %dst, i64 4
- %else.dst.4.uge = icmp uge i32* %else.dst.4, %dst
- %else.dst.6 = getelementptr i32, i32* %dst, i64 6
- %else.dst.6.uge = icmp uge i32* %else.dst.6, %dst
+ %else.dst.4 = getelementptr i32, ptr %dst, i64 4
+ %else.dst.4.uge = icmp uge ptr %else.dst.4, %dst
+ %else.dst.6 = getelementptr i32, ptr %dst, i64 6
+ %else.dst.6.uge = icmp uge ptr %else.dst.6, %dst
%else.res.0 = xor i1 %else.dst.4.uge, %else.dst.6.uge
ret i1 %else.res.0
}
-define i1 @overflow_check_3_or(i32* %dst) {
+define i1 @overflow_check_3_or(ptr %dst) {
; CHECK-LABEL: @overflow_check_3_or(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 5
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 5
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[OR:%.*]] = or i1 [[DST_5_UGE]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[OR]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: ret i1 [[TRUE_DST_4_UGE]]
; CHECK: else:
; CHECK-NEXT: ret i1 false
;
entry:
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%or = or i1 %dst.5.uge, %dst.5.uge
br i1 %or, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %true.dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %true.dst.4.uge = icmp uge ptr %dst.4, %dst
ret i1 %true.dst.4.uge
else:
ret i1 0
}
-define i1 @upper_and_lower_checks_1(i32* %dst, i32 %n) {
+define i1 @upper_and_lower_checks_1(ptr %dst, i32 %n) {
; CHECK-LABEL: @upper_and_lower_checks_1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[DST:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST]], i64 5
-; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult i32* [[DST_5]], [[UPPER]]
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST]], i64 5
+; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult ptr [[DST_5]], [[UPPER]]
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[AND_1:%.*]] = and i1 [[DST_5_ULT]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[AND_1]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[TRUE_DST_4_ULT:%.*]] = icmp ult i32* [[DST_4]], [[UPPER]]
-; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[TRUE_DST_4_ULT:%.*]] = icmp ult ptr [[DST_4]], [[UPPER]]
+; CHECK-NEXT: [[TRUE_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: [[AND:%.*]] = and i1 [[TRUE_DST_4_ULT]], [[TRUE_DST_4_UGE]]
; CHECK-NEXT: ret i1 [[AND]]
; CHECK: else:
@@ -197,17 +197,17 @@ define i1 @upper_and_lower_checks_1(i32* %dst, i32 %n) {
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %dst, i64 %n.ext
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.ult = icmp ult i32* %dst.5, %upper
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %upper = getelementptr inbounds i32, ptr %dst, i64 %n.ext
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.ult = icmp ult ptr %dst.5, %upper
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%and.1 = and i1 %dst.5.ult, %dst.5.uge
br i1 %and.1, label %then, label %else
then:
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %true.dst.4.ult = icmp ult i32* %dst.4, %upper
- %true.dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %true.dst.4.ult = icmp ult ptr %dst.4, %upper
+ %true.dst.4.uge = icmp uge ptr %dst.4, %dst
%and = and i1 %true.dst.4.ult, %true.dst.4.uge
ret i1 %and
@@ -215,20 +215,20 @@ else:
ret i1 0
}
-define i1 @upper_and_lower_checks_2_dst6(i32* %dst, i32 %n) {
+define i1 @upper_and_lower_checks_2_dst6(ptr %dst, i32 %n) {
; CHECK-LABEL: @upper_and_lower_checks_2_dst6(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[DST:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST]], i64 5
-; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult i32* [[DST_5]], [[UPPER]]
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST]], i64 5
+; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult ptr [[DST_5]], [[UPPER]]
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[AND:%.*]] = and i1 [[DST_5_ULT]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[AND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_6:%.*]] = getelementptr i32, i32* [[DST]], i64 6
-; CHECK-NEXT: [[C_DST_6_ULT:%.*]] = icmp ult i32* [[DST_6]], [[UPPER]]
-; CHECK-NEXT: [[TRUE_DST_6_UGE:%.*]] = icmp uge i32* [[DST_6]], [[DST]]
+; CHECK-NEXT: [[DST_6:%.*]] = getelementptr i32, ptr [[DST]], i64 6
+; CHECK-NEXT: [[C_DST_6_ULT:%.*]] = icmp ult ptr [[DST_6]], [[UPPER]]
+; CHECK-NEXT: [[TRUE_DST_6_UGE:%.*]] = icmp uge ptr [[DST_6]], [[DST]]
; CHECK-NEXT: [[RES:%.*]] = and i1 [[C_DST_6_ULT]], [[TRUE_DST_6_UGE]]
; CHECK-NEXT: ret i1 [[RES]]
; CHECK: else:
@@ -236,17 +236,17 @@ define i1 @upper_and_lower_checks_2_dst6(i32* %dst, i32 %n) {
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %dst, i64 %n.ext
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.ult = icmp ult i32* %dst.5, %upper
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %upper = getelementptr inbounds i32, ptr %dst, i64 %n.ext
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.ult = icmp ult ptr %dst.5, %upper
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%and = and i1 %dst.5.ult, %dst.5.uge
br i1 %and, label %then, label %else
then:
- %dst.6 = getelementptr i32, i32* %dst, i64 6
- %c.dst.6.ult = icmp ult i32* %dst.6, %upper
- %true.dst.6.uge = icmp uge i32* %dst.6, %dst
+ %dst.6 = getelementptr i32, ptr %dst, i64 6
+ %c.dst.6.ult = icmp ult ptr %dst.6, %upper
+ %true.dst.6.uge = icmp uge ptr %dst.6, %dst
%res = and i1 %c.dst.6.ult, %true.dst.6.uge
ret i1 %res
@@ -254,20 +254,20 @@ else:
ret i1 0
}
-define i1 @upper_and_lower_checks_2_dst7(i32* %dst, i32 %n) {
+define i1 @upper_and_lower_checks_2_dst7(ptr %dst, i32 %n) {
; CHECK-LABEL: @upper_and_lower_checks_2_dst7(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, i32* [[DST:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST]], i64 5
-; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult i32* [[DST_5]], [[UPPER]]
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[UPPER:%.*]] = getelementptr inbounds i32, ptr [[DST:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST]], i64 5
+; CHECK-NEXT: [[DST_5_ULT:%.*]] = icmp ult ptr [[DST_5]], [[UPPER]]
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[DST_5_ULT]], [[DST_5_UGE]]
; CHECK-NEXT: br i1 [[OR_COND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_7:%.*]] = getelementptr i32, i32* [[DST]], i64 7
-; CHECK-NEXT: [[C_DST_7_ULT:%.*]] = icmp ult i32* [[DST_7]], [[UPPER]]
-; CHECK-NEXT: [[C_DST_7_UGE:%.*]] = icmp uge i32* [[DST_7]], [[DST]]
+; CHECK-NEXT: [[DST_7:%.*]] = getelementptr i32, ptr [[DST]], i64 7
+; CHECK-NEXT: [[C_DST_7_ULT:%.*]] = icmp ult ptr [[DST_7]], [[UPPER]]
+; CHECK-NEXT: [[C_DST_7_UGE:%.*]] = icmp uge ptr [[DST_7]], [[DST]]
; CHECK-NEXT: [[RES:%.*]] = and i1 [[C_DST_7_ULT]], [[C_DST_7_UGE]]
; CHECK-NEXT: ret i1 [[RES]]
; CHECK: else:
@@ -275,17 +275,17 @@ define i1 @upper_and_lower_checks_2_dst7(i32* %dst, i32 %n) {
;
entry:
%n.ext = zext i32 %n to i64
- %upper = getelementptr inbounds i32, i32* %dst, i64 %n.ext
- %dst.5 = getelementptr i32, i32* %dst, i64 5
- %dst.5.ult = icmp ult i32* %dst.5, %upper
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %upper = getelementptr inbounds i32, ptr %dst, i64 %n.ext
+ %dst.5 = getelementptr i32, ptr %dst, i64 5
+ %dst.5.ult = icmp ult ptr %dst.5, %upper
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%or.cond = and i1 %dst.5.ult, %dst.5.uge
br i1 %or.cond, label %then, label %else
then:
- %dst.7 = getelementptr i32, i32* %dst, i64 7
- %c.dst.7.ult = icmp ult i32* %dst.7, %upper
- %c.dst.7.uge = icmp uge i32* %dst.7, %dst
+ %dst.7 = getelementptr i32, ptr %dst, i64 7
+ %c.dst.7.ult = icmp ult ptr %dst.7, %upper
+ %c.dst.7.uge = icmp uge ptr %dst.7, %dst
%res = and i1 %c.dst.7.ult, %c.dst.7.uge
ret i1 %res
@@ -293,20 +293,20 @@ else:
ret i1 0
}
-define i1 @upper_and_lower_checks_lt(i32* %dst, i32 %n) {
+define i1 @upper_and_lower_checks_lt(ptr %dst, i32 %n) {
; CHECK-LABEL: @upper_and_lower_checks_lt(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[N_EXT:%.*]] = zext i32 [[N:%.*]] to i64
-; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, i32* [[DST:%.*]], i64 [[N_EXT]]
-; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge i32* [[DST_5]], [[DST]]
+; CHECK-NEXT: [[DST_5:%.*]] = getelementptr i32, ptr [[DST:%.*]], i64 [[N_EXT]]
+; CHECK-NEXT: [[DST_5_UGE:%.*]] = icmp uge ptr [[DST_5]], [[DST]]
; CHECK-NEXT: [[N_EXT_UGE:%.*]] = icmp uge i64 [[N_EXT]], 3
; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[DST_5_UGE]], [[N_EXT_UGE]]
; CHECK-NEXT: br i1 [[OR_COND]], label [[THEN:%.*]], label [[ELSE:%.*]]
; CHECK: then:
-; CHECK-NEXT: [[DST_3:%.*]] = getelementptr i32, i32* [[DST]], i64 3
-; CHECK-NEXT: [[TRUE_DST_3_UGE:%.*]] = icmp uge i32* [[DST_3]], [[DST]]
-; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, i32* [[DST]], i64 4
-; CHECK-NEXT: [[C_DST_4_UGE:%.*]] = icmp uge i32* [[DST_4]], [[DST]]
+; CHECK-NEXT: [[DST_3:%.*]] = getelementptr i32, ptr [[DST]], i64 3
+; CHECK-NEXT: [[TRUE_DST_3_UGE:%.*]] = icmp uge ptr [[DST_3]], [[DST]]
+; CHECK-NEXT: [[DST_4:%.*]] = getelementptr i32, ptr [[DST]], i64 4
+; CHECK-NEXT: [[C_DST_4_UGE:%.*]] = icmp uge ptr [[DST_4]], [[DST]]
; CHECK-NEXT: [[RES_0:%.*]] = xor i1 [[TRUE_DST_3_UGE]], [[C_DST_4_UGE]]
; CHECK-NEXT: ret i1 [[RES_0]]
; CHECK: else:
@@ -314,17 +314,17 @@ define i1 @upper_and_lower_checks_lt(i32* %dst, i32 %n) {
;
entry:
%n.ext = zext i32 %n to i64
- %dst.5 = getelementptr i32, i32* %dst, i64 %n.ext
- %dst.5.uge = icmp uge i32* %dst.5, %dst
+ %dst.5 = getelementptr i32, ptr %dst, i64 %n.ext
+ %dst.5.uge = icmp uge ptr %dst.5, %dst
%n.ext.uge = icmp uge i64 %n.ext, 3
%or.cond = and i1 %dst.5.uge, %n.ext.uge
br i1 %or.cond, label %then, label %else
then:
- %dst.3 = getelementptr i32, i32* %dst, i64 3
- %true.dst.3.uge = icmp uge i32* %dst.3, %dst
- %dst.4 = getelementptr i32, i32* %dst, i64 4
- %c.dst.4.uge = icmp uge i32* %dst.4, %dst
+ %dst.3 = getelementptr i32, ptr %dst, i64 3
+ %true.dst.3.uge = icmp uge ptr %dst.3, %dst
+ %dst.4 = getelementptr i32, ptr %dst, i64 4
+ %c.dst.4.uge = icmp uge ptr %dst.4, %dst
%res.0 = xor i1 %true.dst.3.uge, %c.dst.4.uge
ret i1 %res.0
diff --git a/llvm/test/Transforms/ConstraintElimination/loops.ll b/llvm/test/Transforms/ConstraintElimination/loops.ll
index 9c69caa8007e5..90c4574e21a0c 100644
--- a/llvm/test/Transforms/ConstraintElimination/loops.ll
+++ b/llvm/test/Transforms/ConstraintElimination/loops.ll
@@ -5,43 +5,43 @@ declare void @use(i1)
; Make sure conditions in loops are not used to simplify themselves.
-define void @loop1(float* %T, float* %x, i32 %points, i32 %trigint) {
+define void @loop1(ptr %T, ptr %x, i32 %points, i32 %trigint) {
; CHECK-LABEL: @loop1(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IDX_EXT:%.*]] = sext i32 [[POINTS:%.*]] to i64
-; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds float, float* [[X:%.*]], i64 [[IDX_EXT]]
-; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds float, float* [[ADD_PTR]], i64 -8
+; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds float, ptr [[X:%.*]], i64 [[IDX_EXT]]
+; CHECK-NEXT: [[ADD_PTR1:%.*]] = getelementptr inbounds float, ptr [[ADD_PTR]], i64 -8
; CHECK-NEXT: [[SHR:%.*]] = ashr i32 [[POINTS]], 1
; CHECK-NEXT: [[IDX_EXT2:%.*]] = sext i32 [[SHR]] to i64
-; CHECK-NEXT: [[ADD_PTR3:%.*]] = getelementptr inbounds float, float* [[X]], i64 [[IDX_EXT2]]
-; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds float, float* [[ADD_PTR3]], i64 -8
+; CHECK-NEXT: [[ADD_PTR3:%.*]] = getelementptr inbounds float, ptr [[X]], i64 [[IDX_EXT2]]
+; CHECK-NEXT: [[ADD_PTR4:%.*]] = getelementptr inbounds float, ptr [[ADD_PTR3]], i64 -8
; CHECK-NEXT: br label [[DO_BODY:%.*]]
; CHECK: do.body:
-; CHECK-NEXT: [[X2_0:%.*]] = phi float* [ [[ADD_PTR4]], [[ENTRY:%.*]] ], [ [[ADD_PTR106:%.*]], [[DO_BODY]] ]
-; CHECK-NEXT: [[X1_0:%.*]] = phi float* [ [[ADD_PTR1]], [[ENTRY]] ], [ [[ADD_PTR105:%.*]], [[DO_BODY]] ]
-; CHECK-NEXT: [[ADD_PTR105]] = getelementptr inbounds float, float* [[X1_0]], i64 -8
-; CHECK-NEXT: [[ADD_PTR106]] = getelementptr inbounds float, float* [[X2_0]], i64 -8
-; CHECK-NEXT: [[CMP:%.*]] = icmp uge float* [[ADD_PTR106]], [[X]]
+; CHECK-NEXT: [[X2_0:%.*]] = phi ptr [ [[ADD_PTR4]], [[ENTRY:%.*]] ], [ [[ADD_PTR106:%.*]], [[DO_BODY]] ]
+; CHECK-NEXT: [[X1_0:%.*]] = phi ptr [ [[ADD_PTR1]], [[ENTRY]] ], [ [[ADD_PTR105:%.*]], [[DO_BODY]] ]
+; CHECK-NEXT: [[ADD_PTR105]] = getelementptr inbounds float, ptr [[X1_0]], i64 -8
+; CHECK-NEXT: [[ADD_PTR106]] = getelementptr inbounds float, ptr [[X2_0]], i64 -8
+; CHECK-NEXT: [[CMP:%.*]] = icmp uge ptr [[ADD_PTR106]], [[X]]
; CHECK-NEXT: br i1 [[CMP]], label [[DO_BODY]], label [[DO_END:%.*]]
; CHECK: do.end:
; CHECK-NEXT: ret void
;
entry:
%idx.ext = sext i32 %points to i64
- %add.ptr = getelementptr inbounds float, float* %x, i64 %idx.ext
- %add.ptr1 = getelementptr inbounds float, float* %add.ptr, i64 -8
+ %add.ptr = getelementptr inbounds float, ptr %x, i64 %idx.ext
+ %add.ptr1 = getelementptr inbounds float, ptr %add.ptr, i64 -8
%shr = ashr i32 %points, 1
%idx.ext2 = sext i32 %shr to i64
- %add.ptr3 = getelementptr inbounds float, float* %x, i64 %idx.ext2
- %add.ptr4 = getelementptr inbounds float, float* %add.ptr3, i64 -8
+ %add.ptr3 = getelementptr inbounds float, ptr %x, i64 %idx.ext2
+ %add.ptr4 = getelementptr inbounds float, ptr %add.ptr3, i64 -8
br label %do.body
do.body: ; preds = %do.body, %entry
- %x2.0 = phi float* [ %add.ptr4, %entry ], [ %add.ptr106, %do.body ]
- %x1.0 = phi float* [ %add.ptr1, %entry ], [ %add.ptr105, %do.body ]
- %add.ptr105 = getelementptr inbounds float, float* %x1.0, i64 -8
- %add.ptr106 = getelementptr inbounds float, float* %x2.0, i64 -8
- %cmp = icmp uge float* %add.ptr106, %x
+ %x2.0 = phi ptr [ %add.ptr4, %entry ], [ %add.ptr106, %do.body ]
+ %x1.0 = phi ptr [ %add.ptr1, %entry ], [ %add.ptr105, %do.body ]
+ %add.ptr105 = getelementptr inbounds float, ptr %x1.0, i64 -8
+ %add.ptr106 = getelementptr inbounds float, ptr %x2.0, i64 -8
+ %cmp = icmp uge ptr %add.ptr106, %x
br i1 %cmp, label %do.body, label %do.end
do.end: ; preds = %do.body
diff --git a/llvm/test/Transforms/ConstraintElimination/mixed.ll b/llvm/test/Transforms/ConstraintElimination/mixed.ll
index c52d4ff58c195..50997dcb9269b 100644
--- a/llvm/test/Transforms/ConstraintElimination/mixed.ll
+++ b/llvm/test/Transforms/ConstraintElimination/mixed.ll
@@ -3,15 +3,15 @@
; Make sure we do not incorrectly add variables to the system.
-define i1 @test(i32* %p1, i32* %p2, i32 %num_rows, i32 %start_row, i1 %c) {
+define i1 @test(ptr %p1, ptr %p2, i32 %num_rows, i32 %start_row, i1 %c) {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[NUM_ROWS:%.*]], [[START_ROW:%.*]]
-; CHECK-NEXT: [[L3:%.*]] = load i32, i32* [[P1:%.*]], align 4
+; CHECK-NEXT: [[L3:%.*]] = load i32, ptr [[P1:%.*]], align 4
; CHECK-NEXT: [[CMP6:%.*]] = icmp ugt i32 [[L3]], [[START_ROW]]
; CHECK-NEXT: br i1 [[C:%.*]], label [[IF_END36:%.*]], label [[IF_END36]]
; CHECK: if.end36:
-; CHECK-NEXT: [[L1:%.*]] = load i32, i32* [[P2:%.*]], align 4
+; CHECK-NEXT: [[L1:%.*]] = load i32, ptr [[P2:%.*]], align 4
; CHECK-NEXT: [[CMP37:%.*]] = icmp ult i32 [[L1]], [[ADD]]
; CHECK-NEXT: br i1 [[CMP37]], label [[IF_THEN39:%.*]], label [[EXIT:%.*]]
; CHECK: if.then39:
@@ -22,12 +22,12 @@ define i1 @test(i32* %p1, i32* %p2, i32 %num_rows, i32 %start_row, i1 %c) {
;
entry:
%add = add i32 %num_rows, %start_row
- %l3 = load i32, i32* %p1, align 4
+ %l3 = load i32, ptr %p1, align 4
%cmp6 = icmp ugt i32 %l3, %start_row
br i1 %c, label %if.end36, label %if.end36
if.end36: ; preds = %if.then11
- %l1 = load i32, i32* %p2, align 4
+ %l1 = load i32, ptr %p2, align 4
%cmp37 = icmp ult i32 %l1, %add
br i1 %cmp37, label %if.then39, label %exit
diff --git a/llvm/test/Transforms/ConstraintElimination/pointercast.ll b/llvm/test/Transforms/ConstraintElimination/pointercast.ll
index 9f141213784b9..1e01c2a30b891 100644
--- a/llvm/test/Transforms/ConstraintElimination/pointercast.ll
+++ b/llvm/test/Transforms/ConstraintElimination/pointercast.ll
@@ -1,112 +1,34 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
-define i1 @bitcast_and_cmp(i32* readonly %src, i32* readnone %min, i32* readnone %max) {
-; CHECK-LABEL: @bitcast_and_cmp(
-; CHECK-NEXT: check.0.min:
-; CHECK-NEXT: [[SRC_C:%.*]] = bitcast i32* [[SRC:%.*]] to i8*
-; CHECK-NEXT: [[MIN_C:%.*]] = bitcast i32* [[MIN:%.*]] to i8*
-; CHECK-NEXT: [[MAX_C:%.*]] = bitcast i32* [[MAX:%.*]] to i16*
-; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 3
-; CHECK-NEXT: [[GEP_3_C:%.*]] = bitcast i32* [[GEP_3]] to i16*
-; CHECK-NEXT: [[C_MIN_0:%.*]] = icmp ult i8* [[SRC_C]], [[MIN_C]]
-; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ugt i16* [[GEP_3_C]], [[MAX_C]]
-; CHECK-NEXT: [[OR:%.*]] = or i1 [[C_MIN_0]], [[C_MAX_3]]
-; CHECK-NEXT: br i1 [[OR]], label [[TRAP:%.*]], label [[CHECKS:%.*]]
-; CHECK: trap:
-; CHECK-NEXT: ret i1 false
-; CHECK: checks:
-; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult i32* [[GEP_3]], [[MIN]]
-; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult i32* [[GEP_3]], [[MAX]]
-; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[C_3_MAX]]
-; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 1
-; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult i32* [[GEP_1]], [[MIN]]
-; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult i32* [[GEP_1]], [[MAX]]
-; CHECK-NEXT: [[RES_2:%.*]] = xor i1 false, true
-; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 2
-; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult i32* [[GEP_2]], [[MIN]]
-; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult i32* [[GEP_2]], [[MAX]]
-; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true
-; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult i32* [[GEP_4]], [[MIN]]
-; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult i32* [[GEP_4]], [[MAX]]
-; CHECK-NEXT: [[RES_4:%.*]] = xor i1 false, [[C_4_MAX]]
-; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_1]], [[RES_2]]
-; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[RES_3]]
-; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[RES_4]]
-; CHECK-NEXT: ret i1 [[RES_7]]
-;
-check.0.min:
- %src.c = bitcast i32* %src to i8*
- %min.c = bitcast i32* %min to i8*
- %max.c = bitcast i32* %max to i16*
-
- %gep.3 = getelementptr inbounds i32, i32* %src, i64 3
- %gep.3.c = bitcast i32* %gep.3 to i16*
- %c.min.0 = icmp ult i8* %src.c, %min.c
- %c.max.3 = icmp ugt i16* %gep.3.c, %max.c
-
- %or = or i1 %c.min.0, %c.max.3
- br i1 %or, label %trap, label %checks
-
-trap:
- ret i1 0
-
-checks:
- %c.3.min = icmp ult i32* %gep.3, %min
- %c.3.max = icmp ult i32* %gep.3, %max
- %res.1 = xor i1 %c.3.min, %c.3.max
-
- %gep.1 = getelementptr inbounds i32, i32* %src, i64 1
- %c.1.min = icmp ult i32* %gep.1, %min
- %c.1.max = icmp ult i32* %gep.1, %max
- %res.2 = xor i1 %c.1.min, %c.1.max
-
- %gep.2 = getelementptr inbounds i32, i32* %src, i64 2
- %c.2.min = icmp ult i32* %gep.2, %min
- %c.2.max = icmp ult i32* %gep.2, %max
- %res.3 = xor i1 %c.2.min, %c.2.max
-
- %gep.4 = getelementptr inbounds i32, i32* %src, i64 4
- %c.4.min = icmp ult i32* %gep.4, %min
- %c.4.max = icmp ult i32* %gep.4, %max
- %res.4 = xor i1 %c.4.min, %c.4.max
-
- %res.5 = xor i1 %res.1, %res.2
- %res.6 = xor i1 %res.5, %res.3
- %res.7 = xor i1 %res.6, %res.4
-
- ret i1 %res.7
-}
-
-define i1 @gep0_and_cmp(i32* readonly %src, i32* readnone %min, i32* readnone %max) {
+define i1 @gep0_and_cmp(ptr readonly %src, ptr readnone %min, ptr readnone %max) {
; CHECK-LABEL: @gep0_and_cmp(
; CHECK-NEXT: check.0.min:
-; CHECK-NEXT: [[SRC_C:%.*]] = getelementptr i32, i32* [[SRC:%.*]], i64 0
-; CHECK-NEXT: [[MIN_C:%.*]] = getelementptr i32, i32* [[MIN:%.*]], i64 0
-; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 3
-; CHECK-NEXT: [[GEP_3_C:%.*]] = getelementptr i32, i32* [[GEP_3]], i32 0
-; CHECK-NEXT: [[C_MIN_0:%.*]] = icmp ult i32* [[SRC_C]], [[MIN_C]]
-; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ugt i32* [[GEP_3_C]], [[MAX:%.*]]
+; CHECK-NEXT: [[SRC_C:%.*]] = getelementptr i32, ptr [[SRC:%.*]], i64 0
+; CHECK-NEXT: [[MIN_C:%.*]] = getelementptr i32, ptr [[MIN:%.*]], i64 0
+; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 3
+; CHECK-NEXT: [[GEP_3_C:%.*]] = getelementptr i32, ptr [[GEP_3]], i32 0
+; CHECK-NEXT: [[C_MIN_0:%.*]] = icmp ult ptr [[SRC_C]], [[MIN_C]]
+; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ugt ptr [[GEP_3_C]], [[MAX:%.*]]
; CHECK-NEXT: [[OR:%.*]] = or i1 [[C_MIN_0]], [[C_MAX_3]]
; CHECK-NEXT: br i1 [[OR]], label [[TRAP:%.*]], label [[CHECKS:%.*]]
; CHECK: trap:
; CHECK-NEXT: ret i1 false
; CHECK: checks:
-; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult i32* [[GEP_3]], [[MIN]]
-; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult i32* [[GEP_3]], [[MAX]]
+; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult ptr [[GEP_3]], [[MIN]]
+; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult ptr [[GEP_3]], [[MAX]]
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[C_3_MAX]]
-; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 1
-; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult i32* [[GEP_1]], [[MIN]]
-; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult i32* [[GEP_1]], [[MAX]]
+; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 1
+; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult ptr [[GEP_1]], [[MIN]]
+; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult ptr [[GEP_1]], [[MAX]]
; CHECK-NEXT: [[RES_2:%.*]] = xor i1 false, true
-; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 2
-; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult i32* [[GEP_2]], [[MIN]]
-; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult i32* [[GEP_2]], [[MAX]]
+; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 2
+; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult ptr [[GEP_2]], [[MIN]]
+; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult ptr [[GEP_2]], [[MAX]]
; CHECK-NEXT: [[RES_3:%.*]] = xor i1 false, true
-; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult i32* [[GEP_4]], [[MIN]]
-; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult i32* [[GEP_4]], [[MAX]]
+; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult ptr [[GEP_4]], [[MIN]]
+; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult ptr [[GEP_4]], [[MAX]]
; CHECK-NEXT: [[RES_4:%.*]] = xor i1 false, [[C_4_MAX]]
; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_1]], [[RES_2]]
; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[RES_3]]
@@ -114,13 +36,13 @@ define i1 @gep0_and_cmp(i32* readonly %src, i32* readnone %min, i32* readnone %m
; CHECK-NEXT: ret i1 [[RES_7]]
;
check.0.min:
- %src.c = getelementptr i32, i32* %src, i64 0
- %min.c = getelementptr i32, i32* %min, i64 0
+ %src.c = getelementptr i32, ptr %src, i64 0
+ %min.c = getelementptr i32, ptr %min, i64 0
- %gep.3 = getelementptr inbounds i32, i32* %src, i64 3
- %gep.3.c = getelementptr i32, i32* %gep.3, i32 0
- %c.min.0 = icmp ult i32* %src.c, %min.c
- %c.max.3 = icmp ugt i32* %gep.3.c, %max
+ %gep.3 = getelementptr inbounds i32, ptr %src, i64 3
+ %gep.3.c = getelementptr i32, ptr %gep.3, i32 0
+ %c.min.0 = icmp ult ptr %src.c, %min.c
+ %c.max.3 = icmp ugt ptr %gep.3.c, %max
%or = or i1 %c.min.0, %c.max.3
br i1 %or, label %trap, label %checks
@@ -129,23 +51,23 @@ trap:
ret i1 0
checks:
- %c.3.min = icmp ult i32* %gep.3, %min
- %c.3.max = icmp ult i32* %gep.3, %max
+ %c.3.min = icmp ult ptr %gep.3, %min
+ %c.3.max = icmp ult ptr %gep.3, %max
%res.1 = xor i1 %c.3.min, %c.3.max
- %gep.1 = getelementptr inbounds i32, i32* %src, i64 1
- %c.1.min = icmp ult i32* %gep.1, %min
- %c.1.max = icmp ult i32* %gep.1, %max
+ %gep.1 = getelementptr inbounds i32, ptr %src, i64 1
+ %c.1.min = icmp ult ptr %gep.1, %min
+ %c.1.max = icmp ult ptr %gep.1, %max
%res.2 = xor i1 %c.1.min, %c.1.max
- %gep.2 = getelementptr inbounds i32, i32* %src, i64 2
- %c.2.min = icmp ult i32* %gep.2, %min
- %c.2.max = icmp ult i32* %gep.2, %max
+ %gep.2 = getelementptr inbounds i32, ptr %src, i64 2
+ %c.2.min = icmp ult ptr %gep.2, %min
+ %c.2.max = icmp ult ptr %gep.2, %max
%res.3 = xor i1 %c.2.min, %c.2.max
- %gep.4 = getelementptr inbounds i32, i32* %src, i64 4
- %c.4.min = icmp ult i32* %gep.4, %min
- %c.4.max = icmp ult i32* %gep.4, %max
+ %gep.4 = getelementptr inbounds i32, ptr %src, i64 4
+ %c.4.min = icmp ult ptr %gep.4, %min
+ %c.4.max = icmp ult ptr %gep.4, %max
%res.4 = xor i1 %c.4.min, %c.4.max
%res.5 = xor i1 %res.1, %res.2
@@ -157,35 +79,35 @@ checks:
; Should not look through addresspacecast, because it may change the pointer
; value.
-define i1 @addrspacecast_and_cmp(i32* readonly %src, i32* readnone %min, i32* readnone %max) {
+define i1 @addrspacecast_and_cmp(ptr readonly %src, ptr readnone %min, ptr readnone %max) {
; CHECK-LABEL: @addrspacecast_and_cmp(
; CHECK-NEXT: check.0.min:
-; CHECK-NEXT: [[SRC_C:%.*]] = addrspacecast i32* [[SRC:%.*]] to i8 addrspace(1)*
-; CHECK-NEXT: [[MIN_C:%.*]] = addrspacecast i32* [[MIN:%.*]] to i8 addrspace(1)*
-; CHECK-NEXT: [[MAX_C:%.*]] = addrspacecast i32* [[MAX:%.*]] to i16 addrspace(1)*
-; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 3
-; CHECK-NEXT: [[GEP_3_C:%.*]] = addrspacecast i32* [[GEP_3]] to i16 addrspace(1)*
-; CHECK-NEXT: [[C_MIN_0:%.*]] = icmp ult i8 addrspace(1)* [[SRC_C]], [[MIN_C]]
-; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ugt i16 addrspace(1)* [[GEP_3_C]], [[MAX_C]]
+; CHECK-NEXT: [[SRC_C:%.*]] = addrspacecast ptr [[SRC:%.*]] to ptr addrspace(1)
+; CHECK-NEXT: [[MIN_C:%.*]] = addrspacecast ptr [[MIN:%.*]] to ptr addrspace(1)
+; CHECK-NEXT: [[MAX_C:%.*]] = addrspacecast ptr [[MAX:%.*]] to ptr addrspace(1)
+; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 3
+; CHECK-NEXT: [[GEP_3_C:%.*]] = addrspacecast ptr [[GEP_3]] to ptr addrspace(1)
+; CHECK-NEXT: [[C_MIN_0:%.*]] = icmp ult ptr addrspace(1) [[SRC_C]], [[MIN_C]]
+; CHECK-NEXT: [[C_MAX_3:%.*]] = icmp ugt ptr addrspace(1) [[GEP_3_C]], [[MAX_C]]
; CHECK-NEXT: [[OR:%.*]] = or i1 [[C_MIN_0]], [[C_MAX_3]]
; CHECK-NEXT: br i1 [[OR]], label [[TRAP:%.*]], label [[CHECKS:%.*]]
; CHECK: trap:
; CHECK-NEXT: ret i1 false
; CHECK: checks:
-; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult i32* [[GEP_3]], [[MIN]]
-; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult i32* [[GEP_3]], [[MAX]]
+; CHECK-NEXT: [[C_3_MIN:%.*]] = icmp ult ptr [[GEP_3]], [[MIN]]
+; CHECK-NEXT: [[C_3_MAX:%.*]] = icmp ult ptr [[GEP_3]], [[MAX]]
; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[C_3_MIN]], [[C_3_MAX]]
-; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 1
-; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult i32* [[GEP_1]], [[MIN]]
-; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult i32* [[GEP_1]], [[MAX]]
+; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 1
+; CHECK-NEXT: [[C_1_MIN:%.*]] = icmp ult ptr [[GEP_1]], [[MIN]]
+; CHECK-NEXT: [[C_1_MAX:%.*]] = icmp ult ptr [[GEP_1]], [[MAX]]
; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[C_1_MIN]], [[C_1_MAX]]
-; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 2
-; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult i32* [[GEP_2]], [[MIN]]
-; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult i32* [[GEP_2]], [[MAX]]
+; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 2
+; CHECK-NEXT: [[C_2_MIN:%.*]] = icmp ult ptr [[GEP_2]], [[MIN]]
+; CHECK-NEXT: [[C_2_MAX:%.*]] = icmp ult ptr [[GEP_2]], [[MAX]]
; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[C_2_MIN]], [[C_2_MAX]]
-; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, i32* [[SRC]], i64 4
-; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult i32* [[GEP_4]], [[MIN]]
-; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult i32* [[GEP_4]], [[MAX]]
+; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, ptr [[SRC]], i64 4
+; CHECK-NEXT: [[C_4_MIN:%.*]] = icmp ult ptr [[GEP_4]], [[MIN]]
+; CHECK-NEXT: [[C_4_MAX:%.*]] = icmp ult ptr [[GEP_4]], [[MAX]]
; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[C_4_MIN]], [[C_4_MAX]]
; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_1]], [[RES_2]]
; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[RES_3]]
@@ -193,14 +115,14 @@ define i1 @addrspacecast_and_cmp(i32* readonly %src, i32* readnone %min, i32* re
; CHECK-NEXT: ret i1 [[RES_7]]
;
check.0.min:
- %src.c = addrspacecast i32* %src to i8 addrspace(1)*
- %min.c = addrspacecast i32* %min to i8 addrspace(1)*
- %max.c = addrspacecast i32* %max to i16 addrspace(1)*
+ %src.c = addrspacecast ptr %src to ptr addrspace(1)
+ %min.c = addrspacecast ptr %min to ptr addrspace(1)
+ %max.c = addrspacecast ptr %max to ptr addrspace(1)
- %gep.3 = getelementptr inbounds i32, i32* %src, i64 3
- %gep.3.c = addrspacecast i32* %gep.3 to i16 addrspace(1) *
- %c.min.0 = icmp ult i8 addrspace(1)* %src.c, %min.c
- %c.max.3 = icmp ugt i16 addrspace(1)* %gep.3.c, %max.c
+ %gep.3 = getelementptr inbounds i32, ptr %src, i64 3
+ %gep.3.c = addrspacecast ptr %gep.3 to ptr addrspace(1)
+ %c.min.0 = icmp ult ptr addrspace(1) %src.c, %min.c
+ %c.max.3 = icmp ugt ptr addrspace(1) %gep.3.c, %max.c
%or = or i1 %c.min.0, %c.max.3
br i1 %or, label %trap, label %checks
@@ -209,23 +131,23 @@ trap:
ret i1 0
checks:
- %c.3.min = icmp ult i32* %gep.3, %min
- %c.3.max = icmp ult i32* %gep.3, %max
+ %c.3.min = icmp ult ptr %gep.3, %min
+ %c.3.max = icmp ult ptr %gep.3, %max
%res.1 = xor i1 %c.3.min, %c.3.max
- %gep.1 = getelementptr inbounds i32, i32* %src, i64 1
- %c.1.min = icmp ult i32* %gep.1, %min
- %c.1.max = icmp ult i32* %gep.1, %max
+ %gep.1 = getelementptr inbounds i32, ptr %src, i64 1
+ %c.1.min = icmp ult ptr %gep.1, %min
+ %c.1.max = icmp ult ptr %gep.1, %max
%res.2 = xor i1 %c.1.min, %c.1.max
- %gep.2 = getelementptr inbounds i32, i32* %src, i64 2
- %c.2.min = icmp ult i32* %gep.2, %min
- %c.2.max = icmp ult i32* %gep.2, %max
+ %gep.2 = getelementptr inbounds i32, ptr %src, i64 2
+ %c.2.min = icmp ult ptr %gep.2, %min
+ %c.2.max = icmp ult ptr %gep.2, %max
%res.3 = xor i1 %c.2.min, %c.2.max
- %gep.4 = getelementptr inbounds i32, i32* %src, i64 4
- %c.4.min = icmp ult i32* %gep.4, %min
- %c.4.max = icmp ult i32* %gep.4, %max
+ %gep.4 = getelementptr inbounds i32, ptr %src, i64 4
+ %c.4.min = icmp ult ptr %gep.4, %min
+ %c.4.max = icmp ult ptr %gep.4, %max
%res.4 = xor i1 %c.4.min, %c.4.max
%res.5 = xor i1 %res.1, %res.2
More information about the llvm-commits
mailing list