[llvm] bcabf0a - StraightLineStrengthReduce: Convert tests to opaque pointers
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 27 18:41:25 PST 2022
Author: Matt Arsenault
Date: 2022-11-27T21:29:33-05:00
New Revision: bcabf0a51f58d1aba6526130fbe88752d402c3de
URL: https://github.com/llvm/llvm-project/commit/bcabf0a51f58d1aba6526130fbe88752d402c3de
DIFF: https://github.com/llvm/llvm-project/commit/bcabf0a51f58d1aba6526130fbe88752d402c3de.diff
LOG: StraightLineStrengthReduce: Convert tests to opaque pointers
Required some manual updates in AMDGPU/pr23975.ll and
slsr-gep.ll. pr23975.ll had another offset 0 GEP that probably should
not have been deleted.
Added:
Modified:
llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/pr23975.ll
llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll
llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll
llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/speculative-slsr.ll
llvm/test/Transforms/StraightLineStrengthReduce/X86/no-slsr.ll
llvm/test/Transforms/StraightLineStrengthReduce/slsr-gep.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/pr23975.ll b/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/pr23975.ll
index 4e79a1dcd6708..110d37c5c9fb4 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/pr23975.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/pr23975.ll
@@ -7,14 +7,14 @@ target triple = "amdgcn--"
%struct.Matrix4x4 = type { [4 x [4 x float]] }
; Function Attrs: nounwind
-define fastcc void @Accelerator_Intersect(%struct.Matrix4x4 addrspace(1)* nocapture readonly %leafTransformations) #0 {
+define fastcc void @Accelerator_Intersect(ptr addrspace(1) nocapture readonly %leafTransformations) #0 {
; CHECK-LABEL: @Accelerator_Intersect(
entry:
%tmp = sext i32 undef to i64
- %arrayidx114 = getelementptr inbounds %struct.Matrix4x4, %struct.Matrix4x4 addrspace(1)* %leafTransformations, i64 %tmp
- %tmp1 = getelementptr %struct.Matrix4x4, %struct.Matrix4x4 addrspace(1)* %leafTransformations, i64 %tmp, i32 0, i64 0, i64 0
-; CHECK: %tmp1 = getelementptr %struct.Matrix4x4, %struct.Matrix4x4 addrspace(1)* %leafTransformations, i64 %tmp, i32 0, i64 0, i64 0
- %tmp2 = load <4 x float>, <4 x float> addrspace(1)* undef, align 4
+ %arrayidx114 = getelementptr inbounds %struct.Matrix4x4, ptr addrspace(1) %leafTransformations, i64 %tmp
+ %tmp1 = getelementptr %struct.Matrix4x4, ptr addrspace(1) %leafTransformations, i64 %tmp, i32 0, i64 0, i64 1
+; CHECK: %tmp1 = getelementptr %struct.Matrix4x4, ptr addrspace(1) %leafTransformations, i64 %tmp, i32 0, i64 0, i64 1
+ %tmp2 = load <4 x float>, ptr addrspace(1) undef, align 4
ret void
}
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll b/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll
index 02faf82ae7633..a495855a4ba75 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/AMDGPU/reassociate-geps-and-slsr-addrspace.ll
@@ -5,26 +5,22 @@ target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:
; CHECK-LABEL: @slsr_after_reassociate_global_geps_mubuf_max_offset(
-; CHECK: [[b1:%[0-9]+]] = getelementptr float, float addrspace(1)* %arr, i64 [[bump:%[0-9]+]]
-; CHECK: [[b2:%[0-9]+]] = getelementptr float, float addrspace(1)* [[b1]], i64 [[bump]]
-define amdgpu_kernel void @slsr_after_reassociate_global_geps_mubuf_max_offset(float addrspace(1)* %out, float addrspace(1)* noalias %arr, i32 %i) {
+; CHECK: [[b1:%[0-9]+]] = getelementptr float, ptr addrspace(1) %arr, i64 [[bump:%[0-9]+]]
+; CHECK: [[b2:%[0-9]+]] = getelementptr float, ptr addrspace(1) [[b1]], i64 [[bump]]
+define amdgpu_kernel void @slsr_after_reassociate_global_geps_mubuf_max_offset(ptr addrspace(1) %out, ptr addrspace(1) noalias %arr, i32 %i) {
bb:
%i2 = shl nsw i32 %i, 1
%j1 = add nsw i32 %i, 1023
%tmp = sext i32 %j1 to i64
- %p1 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp
- %tmp3 = bitcast float addrspace(1)* %p1 to i32 addrspace(1)*
- %v11 = load i32, i32 addrspace(1)* %tmp3, align 4
- %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v11, i32 addrspace(1)* %tmp4, align 4
+ %p1 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
+ %v11 = load i32, ptr addrspace(1) %p1, align 4
+ store i32 %v11, ptr addrspace(1) %out, align 4
%j2 = add nsw i32 %i2, 1023
%tmp5 = sext i32 %j2 to i64
- %p2 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5
- %tmp6 = bitcast float addrspace(1)* %p2 to i32 addrspace(1)*
- %v22 = load i32, i32 addrspace(1)* %tmp6, align 4
- %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v22, i32 addrspace(1)* %tmp7, align 4
+ %p2 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
+ %v22 = load i32, ptr addrspace(1) %p2, align 4
+ store i32 %v22, ptr addrspace(1) %out, align 4
ret void
}
@@ -32,77 +28,65 @@ bb:
; CHECK-LABEL: @slsr_after_reassociate_global_geps_over_mubuf_max_offset(
; CHECK: %j1 = add nsw i32 %i, 1024
; CHECK: %tmp = sext i32 %j1 to i64
-; CHECK: getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp
-; CHECK: getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5
-define amdgpu_kernel void @slsr_after_reassociate_global_geps_over_mubuf_max_offset(float addrspace(1)* %out, float addrspace(1)* noalias %arr, i32 %i) {
+; CHECK: getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
+; CHECK: getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
+define amdgpu_kernel void @slsr_after_reassociate_global_geps_over_mubuf_max_offset(ptr addrspace(1) %out, ptr addrspace(1) noalias %arr, i32 %i) {
bb:
%i2 = shl nsw i32 %i, 1
%j1 = add nsw i32 %i, 1024
%tmp = sext i32 %j1 to i64
- %p1 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp
- %tmp3 = bitcast float addrspace(1)* %p1 to i32 addrspace(1)*
- %v11 = load i32, i32 addrspace(1)* %tmp3, align 4
- %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v11, i32 addrspace(1)* %tmp4, align 4
+ %p1 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp
+ %v11 = load i32, ptr addrspace(1) %p1, align 4
+ store i32 %v11, ptr addrspace(1) %out, align 4
%j2 = add nsw i32 %i2, 1024
%tmp5 = sext i32 %j2 to i64
- %p2 = getelementptr inbounds float, float addrspace(1)* %arr, i64 %tmp5
- %tmp6 = bitcast float addrspace(1)* %p2 to i32 addrspace(1)*
- %v22 = load i32, i32 addrspace(1)* %tmp6, align 4
- %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v22, i32 addrspace(1)* %tmp7, align 4
+ %p2 = getelementptr inbounds float, ptr addrspace(1) %arr, i64 %tmp5
+ %v22 = load i32, ptr addrspace(1) %p2, align 4
+ store i32 %v22, ptr addrspace(1) %out, align 4
ret void
}
; CHECK-LABEL: @slsr_after_reassociate_lds_geps_ds_max_offset(
-; CHECK: [[B1:%[0-9]+]] = getelementptr float, float addrspace(3)* %arr, i32 %i
-; CHECK: getelementptr inbounds float, float addrspace(3)* [[B1]], i32 16383
+; CHECK: [[B1:%[0-9]+]] = getelementptr float, ptr addrspace(3) %arr, i32 %i
+; CHECK: getelementptr inbounds float, ptr addrspace(3) [[B1]], i32 16383
-; CHECK: [[B2:%[0-9]+]] = getelementptr float, float addrspace(3)* [[B1]], i32 %i
-; CHECK: getelementptr inbounds float, float addrspace(3)* [[B2]], i32 16383
-define amdgpu_kernel void @slsr_after_reassociate_lds_geps_ds_max_offset(float addrspace(1)* %out, float addrspace(3)* noalias %arr, i32 %i) {
+; CHECK: [[B2:%[0-9]+]] = getelementptr float, ptr addrspace(3) [[B1]], i32 %i
+; CHECK: getelementptr inbounds float, ptr addrspace(3) [[B2]], i32 16383
+define amdgpu_kernel void @slsr_after_reassociate_lds_geps_ds_max_offset(ptr addrspace(1) %out, ptr addrspace(3) noalias %arr, i32 %i) {
bb:
%i2 = shl nsw i32 %i, 1
%j1 = add nsw i32 %i, 16383
- %p1 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1
- %tmp3 = bitcast float addrspace(3)* %p1 to i32 addrspace(3)*
- %v11 = load i32, i32 addrspace(3)* %tmp3, align 4
- %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v11, i32 addrspace(1)* %tmp4, align 4
+ %p1 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
+ %v11 = load i32, ptr addrspace(3) %p1, align 4
+ store i32 %v11, ptr addrspace(1) %out, align 4
%j2 = add nsw i32 %i2, 16383
- %p2 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2
- %tmp6 = bitcast float addrspace(3)* %p2 to i32 addrspace(3)*
- %v22 = load i32, i32 addrspace(3)* %tmp6, align 4
- %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v22, i32 addrspace(1)* %tmp7, align 4
+ %p2 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
+ %v22 = load i32, ptr addrspace(3) %p2, align 4
+ store i32 %v22, ptr addrspace(1) %out, align 4
ret void
}
; CHECK-LABEL: @slsr_after_reassociate_lds_geps_over_ds_max_offset(
; CHECK: %j1 = add nsw i32 %i, 16384
-; CHECK: getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1
+; CHECK: getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
; CHECK: %j2 = add i32 %j1, %i
-; CHECK: getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2
-define amdgpu_kernel void @slsr_after_reassociate_lds_geps_over_ds_max_offset(float addrspace(1)* %out, float addrspace(3)* noalias %arr, i32 %i) {
+; CHECK: getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
+define amdgpu_kernel void @slsr_after_reassociate_lds_geps_over_ds_max_offset(ptr addrspace(1) %out, ptr addrspace(3) noalias %arr, i32 %i) {
bb:
%i2 = shl nsw i32 %i, 1
%j1 = add nsw i32 %i, 16384
- %p1 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j1
- %tmp3 = bitcast float addrspace(3)* %p1 to i32 addrspace(3)*
- %v11 = load i32, i32 addrspace(3)* %tmp3, align 4
- %tmp4 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v11, i32 addrspace(1)* %tmp4, align 4
+ %p1 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j1
+ %v11 = load i32, ptr addrspace(3) %p1, align 4
+ store i32 %v11, ptr addrspace(1) %out, align 4
%j2 = add nsw i32 %i2, 16384
- %p2 = getelementptr inbounds float, float addrspace(3)* %arr, i32 %j2
- %tmp6 = bitcast float addrspace(3)* %p2 to i32 addrspace(3)*
- %v22 = load i32, i32 addrspace(3)* %tmp6, align 4
- %tmp7 = bitcast float addrspace(1)* %out to i32 addrspace(1)*
- store i32 %v22, i32 addrspace(1)* %tmp7, align 4
+ %p2 = getelementptr inbounds float, ptr addrspace(3) %arr, i32 %j2
+ %v22 = load i32, ptr addrspace(3) %p2, align 4
+ store i32 %v22, ptr addrspace(1) %out, align 4
ret void
}
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll b/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll
index 9e204593d4e26..035787fc145fa 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/reassociate-geps-and-slsr.ll
@@ -27,7 +27,7 @@ target triple = "nvptx64-unknown-unknown"
; *(p3 + 5)
; p4 = p3 + i
; *(p4 + 5)
-define void @slsr_after_reassociate_geps(float* %arr, i32 %i) {
+define void @slsr_after_reassociate_geps(ptr %arr, i32 %i) {
; CHECK-LABEL: @slsr_after_reassociate_geps(
; PTX-LABEL: .visible .func slsr_after_reassociate_geps(
; PTX: ld.param.u64 [[arr:%rd[0-9]+]], [slsr_after_reassociate_geps_param_0];
@@ -37,35 +37,35 @@ define void @slsr_after_reassociate_geps(float* %arr, i32 %i) {
%i4 = shl nsw i32 %i, 2
%j1 = add nsw i32 %i, 5
- %p1 = getelementptr inbounds float, float* %arr, i32 %j1
-; CHECK: [[b1:%[0-9]+]] = getelementptr float, float* %arr, i64 [[bump:%[0-9]+]]
+ %p1 = getelementptr inbounds float, ptr %arr, i32 %j1
+; CHECK: [[b1:%[0-9]+]] = getelementptr float, ptr %arr, i64 [[bump:%[0-9]+]]
; PTX: mul.wide.s32 [[i4:%rd[0-9]+]], [[i]], 4;
; PTX: add.s64 [[base1:%rd[0-9]+]], [[arr]], [[i4]];
- %v1 = load float, float* %p1, align 4
+ %v1 = load float, ptr %p1, align 4
; PTX: ld.f32 {{%f[0-9]+}}, [[[base1]]+20];
call void @foo(float %v1)
%j2 = add nsw i32 %i2, 5
- %p2 = getelementptr inbounds float, float* %arr, i32 %j2
-; CHECK: [[b2:%[0-9]+]] = getelementptr float, float* [[b1]], i64 [[bump]]
+ %p2 = getelementptr inbounds float, ptr %arr, i32 %j2
+; CHECK: [[b2:%[0-9]+]] = getelementptr float, ptr [[b1]], i64 [[bump]]
; PTX: add.s64 [[base2:%rd[0-9]+]], [[base1]], [[i4]];
- %v2 = load float, float* %p2, align 4
+ %v2 = load float, ptr %p2, align 4
; PTX: ld.f32 {{%f[0-9]+}}, [[[base2]]+20];
call void @foo(float %v2)
%j3 = add nsw i32 %i3, 5
- %p3 = getelementptr inbounds float, float* %arr, i32 %j3
-; CHECK: [[b3:%[0-9]+]] = getelementptr float, float* [[b2]], i64 [[bump]]
+ %p3 = getelementptr inbounds float, ptr %arr, i32 %j3
+; CHECK: [[b3:%[0-9]+]] = getelementptr float, ptr [[b2]], i64 [[bump]]
; PTX: add.s64 [[base3:%rd[0-9]+]], [[base2]], [[i4]];
- %v3 = load float, float* %p3, align 4
+ %v3 = load float, ptr %p3, align 4
; PTX: ld.f32 {{%f[0-9]+}}, [[[base3]]+20];
call void @foo(float %v3)
%j4 = add nsw i32 %i4, 5
- %p4 = getelementptr inbounds float, float* %arr, i32 %j4
-; CHECK: [[b4:%[0-9]+]] = getelementptr float, float* [[b3]], i64 [[bump]]
+ %p4 = getelementptr inbounds float, ptr %arr, i32 %j4
+; CHECK: [[b4:%[0-9]+]] = getelementptr float, ptr [[b3]], i64 [[bump]]
; PTX: add.s64 [[base4:%rd[0-9]+]], [[base3]], [[i4]];
- %v4 = load float, float* %p4, align 4
+ %v4 = load float, ptr %p4, align 4
; PTX: ld.f32 {{%f[0-9]+}}, [[[base4]]+20];
call void @foo(float %v4)
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/speculative-slsr.ll b/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/speculative-slsr.ll
index cb73565b152eb..9fe94d6fd3b3e 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/speculative-slsr.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/NVPTX/speculative-slsr.ll
@@ -68,4 +68,4 @@ declare void @use(i32)
!nvvm.annotations = !{!0}
-!0 = !{void (i32, i32)* @foo, !"kernel", i32 1}
+!0 = !{ptr @foo, !"kernel", i32 1}
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/X86/no-slsr.ll b/llvm/test/Transforms/StraightLineStrengthReduce/X86/no-slsr.ll
index 3ac49e954462d..7608be9a90c41 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/X86/no-slsr.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/X86/no-slsr.ll
@@ -6,22 +6,21 @@ target triple = "x86_64-unknown-linux-gnu"
; Do not perform SLSR on &input[s] and &input[s * 2] which fit into addressing
; modes of X86.
-define i32 @no_slsr_gep(i32* %input, i64 %s) {
+define i32 @no_slsr_gep(ptr %input, i64 %s) {
; CHECK-LABEL: @no_slsr_gep(
; v0 = input[0];
- %p0 = getelementptr inbounds i32, i32* %input, i64 0
- %v0 = load i32, i32* %p0
+ %v0 = load i32, ptr %input
; v1 = input[s];
- %p1 = getelementptr inbounds i32, i32* %input, i64 %s
-; CHECK: %p1 = getelementptr inbounds i32, i32* %input, i64 %s
- %v1 = load i32, i32* %p1
+ %p1 = getelementptr inbounds i32, ptr %input, i64 %s
+; CHECK: %p1 = getelementptr inbounds i32, ptr %input, i64 %s
+ %v1 = load i32, ptr %p1
; v2 = input[s * 2];
%s2 = mul nsw i64 %s, 2
- %p2 = getelementptr inbounds i32, i32* %input, i64 %s2
-; CHECK: %p2 = getelementptr inbounds i32, i32* %input, i64 %s2
- %v2 = load i32, i32* %p2
+ %p2 = getelementptr inbounds i32, ptr %input, i64 %s2
+; CHECK: %p2 = getelementptr inbounds i32, ptr %input, i64 %s2
+ %v2 = load i32, ptr %p2
; return v0 + v1 + v2;
%1 = add i32 %v0, %v1
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/slsr-gep.ll b/llvm/test/Transforms/StraightLineStrengthReduce/slsr-gep.ll
index 9df5460df0f4d..8c800b81a175f 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/slsr-gep.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/slsr-gep.ll
@@ -13,22 +13,21 @@ target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64-p:64:64:64-p1:32:32:32"
; foo(*p1);
; p2 = p1 + s;
; foo(*p2);
-define void @slsr_gep(i32* %input, i64 %s) {
+define void @slsr_gep(ptr %input, i64 %s) {
; CHECK-LABEL: @slsr_gep(
; v0 = input[0];
- %p0 = getelementptr inbounds i32, i32* %input, i64 0
- call void @foo(i32* %p0)
+ call void @foo(ptr %input)
; v1 = input[s];
- %p1 = getelementptr inbounds i32, i32* %input, i64 %s
-; CHECK: %p1 = getelementptr inbounds i32, i32* %input, i64 %s
- call void @foo(i32* %p1)
+ %p1 = getelementptr inbounds i32, ptr %input, i64 %s
+; CHECK: %p1 = getelementptr inbounds i32, ptr %input, i64 %s
+ call void @foo(ptr %p1)
; v2 = input[s * 2];
%s2 = shl nsw i64 %s, 1
- %p2 = getelementptr inbounds i32, i32* %input, i64 %s2
-; CHECK: %p2 = getelementptr inbounds i32, i32* %p1, i64 %s
- call void @foo(i32* %p2)
+ %p2 = getelementptr inbounds i32, ptr %input, i64 %s2
+; CHECK: %p2 = getelementptr inbounds i32, ptr %p1, i64 %s
+ call void @foo(ptr %p2)
ret void
}
@@ -43,24 +42,23 @@ define void @slsr_gep(i32* %input, i64 %s) {
; foo(*p1);
; p2 = p1 + (long)s;
; foo(*p2);
-define void @slsr_gep_sext(i32* %input, i32 %s) {
+define void @slsr_gep_sext(ptr %input, i32 %s) {
; CHECK-LABEL: @slsr_gep_sext(
; v0 = input[0];
- %p0 = getelementptr inbounds i32, i32* %input, i64 0
- call void @foo(i32* %p0)
+ call void @foo(ptr %input)
; v1 = input[s];
%t = sext i32 %s to i64
- %p1 = getelementptr inbounds i32, i32* %input, i64 %t
-; CHECK: %p1 = getelementptr inbounds i32, i32* %input, i64 %t
- call void @foo(i32* %p1)
+ %p1 = getelementptr inbounds i32, ptr %input, i64 %t
+; CHECK: %p1 = getelementptr inbounds i32, ptr %input, i64 %t
+ call void @foo(ptr %p1)
; v2 = input[s * 2];
%s2 = shl nsw i32 %s, 1
%t2 = sext i32 %s2 to i64
- %p2 = getelementptr inbounds i32, i32* %input, i64 %t2
-; CHECK: %p2 = getelementptr inbounds i32, i32* %p1, i64 %t
- call void @foo(i32* %p2)
+ %p2 = getelementptr inbounds i32, ptr %input, i64 %t2
+; CHECK: %p2 = getelementptr inbounds i32, ptr %p1, i64 %t
+ call void @foo(ptr %p2)
ret void
}
@@ -76,24 +74,24 @@ define void @slsr_gep_sext(i32* %input, i32 %s) {
; foo(*p1);
; p2 = p1 + 5s;
; foo(*p2);
-define void @slsr_gep_2d([10 x [5 x i32]]* %input, i64 %s, i64 %t) {
+define void @slsr_gep_2d(ptr %input, i64 %s, i64 %t) {
; CHECK-LABEL: @slsr_gep_2d(
; v0 = input[s][t];
- %p0 = getelementptr inbounds [10 x [5 x i32]], [10 x [5 x i32]]* %input, i64 0, i64 %s, i64 %t
- call void @foo(i32* %p0)
+ %p0 = getelementptr inbounds [10 x [5 x i32]], ptr %input, i64 0, i64 %s, i64 %t
+ call void @foo(ptr %p0)
; v1 = input[s * 2][t];
%s2 = shl nsw i64 %s, 1
; CHECK: [[BUMP:%[a-zA-Z0-9]+]] = mul i64 %s, 5
- %p1 = getelementptr inbounds [10 x [5 x i32]], [10 x [5 x i32]]* %input, i64 0, i64 %s2, i64 %t
-; CHECK: %p1 = getelementptr inbounds i32, i32* %p0, i64 [[BUMP]]
- call void @foo(i32* %p1)
+ %p1 = getelementptr inbounds [10 x [5 x i32]], ptr %input, i64 0, i64 %s2, i64 %t
+; CHECK: %p1 = getelementptr inbounds i32, ptr %p0, i64 [[BUMP]]
+ call void @foo(ptr %p1)
; v3 = input[s * 3][t];
%s3 = mul nsw i64 %s, 3
- %p2 = getelementptr inbounds [10 x [5 x i32]], [10 x [5 x i32]]* %input, i64 0, i64 %s3, i64 %t
-; CHECK: %p2 = getelementptr inbounds i32, i32* %p1, i64 [[BUMP]]
- call void @foo(i32* %p2)
+ %p2 = getelementptr inbounds [10 x [5 x i32]], ptr %input, i64 0, i64 %s3, i64 %t
+; CHECK: %p2 = getelementptr inbounds i32, ptr %p1, i64 [[BUMP]]
+ call void @foo(ptr %p2)
ret void
}
@@ -106,87 +104,85 @@ define void @slsr_gep_2d([10 x [5 x i32]]* %input, i64 %s, i64 %t) {
; which may not be divisible by typeof(input[s][t].f1) = 8. Therefore, we
; rewrite the candidates using byte offset instead of index offset as in
; @slsr_gep_2d.
-define void @slsr_gep_uglygep([10 x [5 x %struct.S]]* %input, i64 %s, i64 %t) {
+define void @slsr_gep_uglygep(ptr %input, i64 %s, i64 %t) {
; CHECK-LABEL: @slsr_gep_uglygep(
; v0 = input[s][t].f1;
- %p0 = getelementptr inbounds [10 x [5 x %struct.S]], [10 x [5 x %struct.S]]* %input, i64 0, i64 %s, i64 %t, i32 0
- call void @bar(i64* %p0)
+ %p0 = getelementptr inbounds [10 x [5 x %struct.S]], ptr %input, i64 0, i64 %s, i64 %t, i32 0
+ call void @bar(ptr %p0)
; v1 = input[s * 2][t].f1;
%s2 = shl nsw i64 %s, 1
; CHECK: [[BUMP:%[a-zA-Z0-9]+]] = mul i64 %s, 60
- %p1 = getelementptr inbounds [10 x [5 x %struct.S]], [10 x [5 x %struct.S]]* %input, i64 0, i64 %s2, i64 %t, i32 0
-; CHECK: getelementptr inbounds i8, i8* %{{[0-9]+}}, i64 [[BUMP]]
- call void @bar(i64* %p1)
+ %p1 = getelementptr inbounds [10 x [5 x %struct.S]], ptr %input, i64 0, i64 %s2, i64 %t, i32 0
+; CHECK: %p1 = getelementptr inbounds i8, ptr %p0, i64 [[BUMP]]
+ call void @bar(ptr %p1)
; v2 = input[s * 3][t].f1;
%s3 = mul nsw i64 %s, 3
- %p2 = getelementptr inbounds [10 x [5 x %struct.S]], [10 x [5 x %struct.S]]* %input, i64 0, i64 %s3, i64 %t, i32 0
-; CHECK: getelementptr inbounds i8, i8* %{{[0-9]+}}, i64 [[BUMP]]
- call void @bar(i64* %p2)
+ %p2 = getelementptr inbounds [10 x [5 x %struct.S]], ptr %input, i64 0, i64 %s3, i64 %t, i32 0
+; CHECK: %p2 = getelementptr inbounds i8, ptr %p1, i64 [[BUMP]]
+ call void @bar(ptr %p2)
ret void
}
-define void @slsr_out_of_bounds_gep(i32* %input, i32 %s) {
+define void @slsr_out_of_bounds_gep(ptr %input, i32 %s) {
; CHECK-LABEL: @slsr_out_of_bounds_gep(
; v0 = input[0];
- %p0 = getelementptr i32, i32* %input, i64 0
- call void @foo(i32* %p0)
+ call void @foo(ptr %input)
; v1 = input[(long)s];
%t = sext i32 %s to i64
- %p1 = getelementptr i32, i32* %input, i64 %t
-; CHECK: %p1 = getelementptr i32, i32* %input, i64 %t
- call void @foo(i32* %p1)
+ %p1 = getelementptr i32, ptr %input, i64 %t
+; CHECK: %p1 = getelementptr i32, ptr %input, i64 %t
+ call void @foo(ptr %p1)
; v2 = input[(long)(s * 2)];
%s2 = shl nsw i32 %s, 1
%t2 = sext i32 %s2 to i64
- %p2 = getelementptr i32, i32* %input, i64 %t2
-; CHECK: %p2 = getelementptr i32, i32* %p1, i64 %t
- call void @foo(i32* %p2)
+ %p2 = getelementptr i32, ptr %input, i64 %t2
+; CHECK: %p2 = getelementptr i32, ptr %p1, i64 %t
+ call void @foo(ptr %p2)
ret void
}
-define void @slsr_gep_128bit_index(i32* %input, i128 %s) {
+define void @slsr_gep_128bit_index(ptr %input, i128 %s) {
; CHECK-LABEL: @slsr_gep_128bit_index(
; p0 = &input[0]
- %p0 = getelementptr inbounds i32, i32* %input, i128 0
- call void @foo(i32* %p0)
+ call void @foo(ptr %input)
; p1 = &input[s << 125]
%s125 = shl nsw i128 %s, 125
- %p1 = getelementptr inbounds i32, i32* %input, i128 %s125
-; CHECK: %p1 = getelementptr inbounds i32, i32* %input, i128 %s125
- call void @foo(i32* %p1)
+ %p1 = getelementptr inbounds i32, ptr %input, i128 %s125
+; CHECK: %p1 = getelementptr inbounds i32, ptr %input, i128 %s125
+ call void @foo(ptr %p1)
; p2 = &input[s << 126]
%s126 = shl nsw i128 %s, 126
- %p2 = getelementptr inbounds i32, i32* %input, i128 %s126
-; CHECK: %p2 = getelementptr inbounds i32, i32* %input, i128 %s126
- call void @foo(i32* %p2)
+ %p2 = getelementptr inbounds i32, ptr %input, i128 %s126
+; CHECK: %p2 = getelementptr inbounds i32, ptr %input, i128 %s126
+ call void @foo(ptr %p2)
ret void
}
-define void @slsr_gep_32bit_pointer(i32 addrspace(1)* %input, i64 %s) {
+define void @slsr_gep_32bit_pointer(ptr addrspace(1) %input, i64 %s) {
; CHECK-LABEL: @slsr_gep_32bit_pointer(
; p1 = &input[s]
- %p1 = getelementptr inbounds i32, i32 addrspace(1)* %input, i64 %s
- call void @baz(i32 addrspace(1)* %p1)
+ %p1 = getelementptr inbounds i32, ptr addrspace(1) %input, i64 %s
+ call void @baz(ptr addrspace(1) %p1)
; p2 = &input[s * 2]
%s2 = mul nsw i64 %s, 2
- %p2 = getelementptr inbounds i32, i32 addrspace(1)* %input, i64 %s2
+ %p2 = getelementptr inbounds i32, ptr addrspace(1) %input, i64 %s2
; %s2 is wider than the pointer size of addrspace(1), so do not factor it.
-; CHECK: %p2 = getelementptr inbounds i32, i32 addrspace(1)* %input, i64 %s2
- call void @baz(i32 addrspace(1)* %p2)
+; CHECK: %p2 = getelementptr inbounds i32, ptr addrspace(1) %input, i64 %s2
+ call void @baz(ptr addrspace(1) %p2)
ret void
}
-declare void @foo(i32*)
-declare void @bar(i64*)
-declare void @baz(i32 addrspace(1)*)
+declare void @foo(ptr)
+declare void @bar(ptr)
+declare void @baz(ptr addrspace(1))
More information about the llvm-commits
mailing list