[llvm] ab088de - [SROA] Regenerate test checks (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 03:24:19 PDT 2022
Author: Nikita Popov
Date: 2022-06-21T12:24:11+02:00
New Revision: ab088de8734bc3875bd69fce6df47907b3a60f11
URL: https://github.com/llvm/llvm-project/commit/ab088de8734bc3875bd69fce6df47907b3a60f11
DIFF: https://github.com/llvm/llvm-project/commit/ab088de8734bc3875bd69fce6df47907b3a60f11.diff
LOG: [SROA] Regenerate test checks (NFC)
Added:
Modified:
llvm/test/Transforms/SROA/address-spaces.ll
llvm/test/Transforms/SROA/alloca-address-space.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SROA/address-spaces.ll b/llvm/test/Transforms/SROA/address-spaces.ll
index c7e907827ea8e..520b162116d7b 100644
--- a/llvm/test/Transforms/SROA/address-spaces.ll
+++ b/llvm/test/Transforms/SROA/address-spaces.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=sroa -S | FileCheck %s
target datalayout = "e-p:64:64:64-p1:16:16:16-p3:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
@@ -10,9 +11,11 @@ declare void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1)* nocapture, i8 addrspace
; Make sure an illegal bitcast isn't introduced
define void @test_address_space_1_1(<2 x i64> addrspace(1)* %a, i16 addrspace(1)* %b) {
; CHECK-LABEL: @test_address_space_1_1(
-; CHECK: load <2 x i64>, <2 x i64> addrspace(1)* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64> addrspace(1)* {{.*}}, align 2
-; CHECK: ret void
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64> addrspace(1)* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16 addrspace(1)* [[B:%.*]] to <2 x i64> addrspace(1)*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64> addrspace(1)* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16
%aptr = bitcast <2 x i64> addrspace(1)* %a to i8 addrspace(1)*
%aaptr = bitcast <2 x i64>* %aa to i8*
@@ -24,9 +27,11 @@ define void @test_address_space_1_1(<2 x i64> addrspace(1)* %a, i16 addrspace(1)
define void @test_address_space_1_0(<2 x i64> addrspace(1)* %a, i16* %b) {
; CHECK-LABEL: @test_address_space_1_0(
-; CHECK: load <2 x i64>, <2 x i64> addrspace(1)* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64>* {{.*}}, align 2
-; CHECK: ret void
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64> addrspace(1)* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16* [[B:%.*]] to <2 x i64>*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64>* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16
%aptr = bitcast <2 x i64> addrspace(1)* %a to i8 addrspace(1)*
%aaptr = bitcast <2 x i64>* %aa to i8*
@@ -38,9 +43,11 @@ define void @test_address_space_1_0(<2 x i64> addrspace(1)* %a, i16* %b) {
define void @test_address_space_0_1(<2 x i64>* %a, i16 addrspace(1)* %b) {
; CHECK-LABEL: @test_address_space_0_1(
-; CHECK: load <2 x i64>, <2 x i64>* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64> addrspace(1)* {{.*}}, align 2
-; CHECK: ret void
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64>* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16 addrspace(1)* [[B:%.*]] to <2 x i64> addrspace(1)*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64> addrspace(1)* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16
%aptr = bitcast <2 x i64>* %a to i8*
%aaptr = bitcast <2 x i64>* %aa to i8*
@@ -54,7 +61,23 @@ define void @test_address_space_0_1(<2 x i64>* %a, i16 addrspace(1)* %b) {
define void @copy_struct([5 x i64] %in.coerce, i8 addrspace(1)* align 4 %ptr) {
; CHECK-LABEL: @copy_struct(
-; CHECK-NOT: memcpy
+; CHECK-NEXT: for.end:
+; CHECK-NEXT: [[IN_COERCE_FCA_0_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE:%.*]], 0
+; CHECK-NEXT: [[IN_COERCE_FCA_1_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 1
+; CHECK-NEXT: [[IN_COERCE_FCA_2_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 2
+; CHECK-NEXT: [[IN_COERCE_FCA_3_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 3
+; CHECK-NEXT: [[IN_SROA_2_4_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[PTR:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: [[IN_SROA_2_4_EXTRACT_SHIFT:%.*]] = lshr i64 [[IN_COERCE_FCA_2_EXTRACT]], 32
+; CHECK-NEXT: [[IN_SROA_2_4_EXTRACT_TRUNC:%.*]] = trunc i64 [[IN_SROA_2_4_EXTRACT_SHIFT]] to i32
+; CHECK-NEXT: store i32 [[IN_SROA_2_4_EXTRACT_TRUNC]], i32 addrspace(1)* [[IN_SROA_2_4_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: [[IN_SROA_4_20_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[PTR]], i16 4
+; CHECK-NEXT: [[IN_SROA_4_20_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[IN_SROA_4_20_PTR_SROA_IDX]] to i64 addrspace(1)*
+; CHECK-NEXT: store i64 [[IN_COERCE_FCA_3_EXTRACT]], i64 addrspace(1)* [[IN_SROA_4_20_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: [[IN_SROA_5_20_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[PTR]], i16 12
+; CHECK-NEXT: [[IN_SROA_5_20_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[IN_SROA_5_20_PTR_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 undef, i32 addrspace(1)* [[IN_SROA_5_20_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: ret void
+;
for.end:
%in = alloca %struct.struct_test_27.0.13, align 8
%0 = bitcast %struct.struct_test_27.0.13* %in to [5 x i64]*
@@ -64,7 +87,7 @@ for.end:
call void @llvm.memcpy.p1i8.p0i8.i32(i8 addrspace(1)* align 4 %ptr, i8* align 4 %scevgep910, i32 16, i1 false)
ret void
}
-
+
%union.anon = type { i32* }
@g = common global i32 0, align 4
@@ -74,8 +97,12 @@ for.end:
; illegal bitcast isn't introduced
define void @pr27557() {
; CHECK-LABEL: @pr27557(
-; CHECK: %[[CAST:.*]] = bitcast i32** {{.*}} to i32 addrspace(3)**
-; CHECK: store i32 addrspace(3)* @l, i32 addrspace(3)** %[[CAST]]
+; CHECK-NEXT: [[DOTSROA_0:%.*]] = alloca i32*, align 8
+; CHECK-NEXT: store i32* @g, i32** [[DOTSROA_0]], align 8
+; CHECK-NEXT: [[DOTSROA_0_0__SROA_CAST1:%.*]] = bitcast i32** [[DOTSROA_0]] to i32 addrspace(3)**
+; CHECK-NEXT: store i32 addrspace(3)* @l, i32 addrspace(3)** [[DOTSROA_0_0__SROA_CAST1]], align 8
+; CHECK-NEXT: ret void
+;
%1 = alloca %union.anon, align 8
%2 = bitcast %union.anon* %1 to i32**
store i32* @g, i32** %2, align 8
@@ -90,7 +117,8 @@ define void @pr27557() {
; should be promoted through the pair of `ptrtoint`/`inttoptr`.
define i32* @pr27557.alt() {
; CHECK-LABEL: @pr27557.alt(
-; CHECK: ret i32* inttoptr (i64 ptrtoint (i32 addrspace(2)* @l2 to i64) to i32*)
+; CHECK-NEXT: ret i32* inttoptr (i64 ptrtoint (i32 addrspace(2)* @l2 to i64) to i32*)
+;
%1 = alloca %union.anon, align 8
%2 = bitcast %union.anon* %1 to i32 addrspace(2)**
store i32 addrspace(2)* @l2, i32 addrspace(2)** %2, align 8
@@ -101,30 +129,52 @@ define i32* @pr27557.alt() {
; Make sure pre-splitting doesn't try to introduce an illegal bitcast
define float @presplit(i64 addrspace(1)* %p) {
-entry:
; CHECK-LABEL: @presplit(
-; CHECK: %[[CAST:.*]] = bitcast i64 addrspace(1)* {{.*}} to i32 addrspace(1)*
-; CHECK: load i32, i32 addrspace(1)* %[[CAST]]
- %b = alloca i64
- %b.cast = bitcast i64* %b to [2 x float]*
- %b.gep1 = getelementptr [2 x float], [2 x float]* %b.cast, i32 0, i32 0
- %b.gep2 = getelementptr [2 x float], [2 x float]* %b.cast, i32 0, i32 1
- %l = load i64, i64 addrspace(1)* %p
- store i64 %l, i64* %b
- %f1 = load float, float* %b.gep1
- %f2 = load float, float* %b.gep2
- %ret = fadd float %f1, %f2
- ret float %ret
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[P_SROA_CAST:%.*]] = bitcast i64 addrspace(1)* [[P:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: [[L1:%.*]] = load i32, i32 addrspace(1)* [[P_SROA_CAST]], align 4
+; CHECK-NEXT: [[P_SROA_RAW_CAST:%.*]] = bitcast i64 addrspace(1)* [[P]] to i8 addrspace(1)*
+; CHECK-NEXT: [[P_SROA_RAW_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[P_SROA_RAW_CAST]], i16 4
+; CHECK-NEXT: [[P_SROA_CAST2:%.*]] = bitcast i8 addrspace(1)* [[P_SROA_RAW_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: [[L3:%.*]] = load i32, i32 addrspace(1)* [[P_SROA_CAST2]], align 4
+; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32 [[L1]] to float
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32 [[L3]] to float
+; CHECK-NEXT: [[RET:%.*]] = fadd float [[TMP0]], [[TMP1]]
+; CHECK-NEXT: ret float [[RET]]
+;
+entry:
+ %b = alloca i64
+ %b.cast = bitcast i64* %b to [2 x float]*
+ %b.gep1 = getelementptr [2 x float], [2 x float]* %b.cast, i32 0, i32 0
+ %b.gep2 = getelementptr [2 x float], [2 x float]* %b.cast, i32 0, i32 1
+ %l = load i64, i64 addrspace(1)* %p
+ store i64 %l, i64* %b
+ %f1 = load float, float* %b.gep1
+ %f2 = load float, float* %b.gep2
+ %ret = fadd float %f1, %f2
+ ret float %ret
}
; Test load from and store to non-zero address space.
define void @test_load_store_
diff _addr_space([2 x float] addrspace(1)* %complex1, [2 x float] addrspace(1)* %complex2) {
-; CHECK-LABEL: @test_load_store_
diff _addr_space
-; CHECK-NOT: alloca
-; CHECK: load i32, i32 addrspace(1)*
-; CHECK: load i32, i32 addrspace(1)*
-; CHECK: store i32 %{{.*}}, i32 addrspace(1)*
-; CHECK: store i32 %{{.*}}, i32 addrspace(1)*
+; CHECK-LABEL: @test_load_store_
diff _addr_space(
+; CHECK-NEXT: [[P1_SROA_CAST:%.*]] = bitcast [2 x float] addrspace(1)* [[COMPLEX1:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: [[V15:%.*]] = load i32, i32 addrspace(1)* [[P1_SROA_CAST]], align 4
+; CHECK-NEXT: [[P1_SROA_IDX:%.*]] = getelementptr inbounds [2 x float], [2 x float] addrspace(1)* [[COMPLEX1]], i16 0, i16 1
+; CHECK-NEXT: [[P1_SROA_CAST7:%.*]] = bitcast float addrspace(1)* [[P1_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: [[V18:%.*]] = load i32, i32 addrspace(1)* [[P1_SROA_CAST7]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32 [[V15]] to float
+; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[V18]] to float
+; CHECK-NEXT: [[SUM:%.*]] = fadd float [[TMP1]], [[TMP2]]
+; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[SUM]] to i32
+; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[SUM]] to i32
+; CHECK-NEXT: [[P2_SROA_CAST:%.*]] = bitcast [2 x float] addrspace(1)* [[COMPLEX2:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 [[TMP3]], i32 addrspace(1)* [[P2_SROA_CAST]], align 4
+; CHECK-NEXT: [[P2_SROA_IDX:%.*]] = getelementptr inbounds [2 x float], [2 x float] addrspace(1)* [[COMPLEX2]], i16 0, i16 1
+; CHECK-NEXT: [[P2_SROA_CAST4:%.*]] = bitcast float addrspace(1)* [[P2_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 [[TMP4]], i32 addrspace(1)* [[P2_SROA_CAST4]], align 4
+; CHECK-NEXT: ret void
+;
%a = alloca i64
%a.cast = bitcast i64* %a to [2 x float]*
%a.gep1 = getelementptr [2 x float], [2 x float]* %a.cast, i32 0, i32 0
diff --git a/llvm/test/Transforms/SROA/alloca-address-space.ll b/llvm/test/Transforms/SROA/alloca-address-space.ll
index fa0fc24eed194..01cd543eabec9 100644
--- a/llvm/test/Transforms/SROA/alloca-address-space.ll
+++ b/llvm/test/Transforms/SROA/alloca-address-space.ll
@@ -1,3 +1,4 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=sroa -S | FileCheck %s
target datalayout = "e-p:64:64:64-p1:16:16:16-p2:32:32-p3:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64-A2"
@@ -7,12 +8,13 @@ declare void @llvm.memcpy.p2i8.p1i8.i32(i8 addrspace(2)* nocapture, i8 addrspace
declare void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1)* nocapture, i8 addrspace(1)* nocapture readonly, i32, i1)
-
-; CHECK-LABEL: @test_address_space_1_1(
-; CHECK: load <2 x i64>, <2 x i64> addrspace(1)* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64> addrspace(1)* {{.*}}, align 2
-; CHECK: ret void
define void @test_address_space_1_1(<2 x i64> addrspace(1)* %a, i16 addrspace(1)* %b) {
+; CHECK-LABEL: @test_address_space_1_1(
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64> addrspace(1)* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16 addrspace(1)* [[B:%.*]] to <2 x i64> addrspace(1)*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64> addrspace(1)* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16, addrspace(2)
%aptr = bitcast <2 x i64> addrspace(1)* %a to i8 addrspace(1)*
%aaptr = bitcast <2 x i64> addrspace(2)* %aa to i8 addrspace(2)*
@@ -22,11 +24,13 @@ define void @test_address_space_1_1(<2 x i64> addrspace(1)* %a, i16 addrspace(1)
ret void
}
-; CHECK-LABEL: @test_address_space_1_0(
-; CHECK: load <2 x i64>, <2 x i64> addrspace(1)* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64> addrspace(2)* {{.*}}, align 2
-; CHECK: ret void
define void @test_address_space_1_0(<2 x i64> addrspace(1)* %a, i16 addrspace(2)* %b) {
+; CHECK-LABEL: @test_address_space_1_0(
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64> addrspace(1)* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16 addrspace(2)* [[B:%.*]] to <2 x i64> addrspace(2)*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64> addrspace(2)* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16, addrspace(2)
%aptr = bitcast <2 x i64> addrspace(1)* %a to i8 addrspace(1)*
%aaptr = bitcast <2 x i64> addrspace(2)* %aa to i8 addrspace(2)*
@@ -36,11 +40,13 @@ define void @test_address_space_1_0(<2 x i64> addrspace(1)* %a, i16 addrspace(2)
ret void
}
-; CHECK-LABEL: @test_address_space_0_1(
-; CHECK: load <2 x i64>, <2 x i64> addrspace(2)* %a, align 2
-; CHECK: store <2 x i64> {{.*}}, <2 x i64> addrspace(1)* {{.*}}, align 2
-; CHECK: ret void
define void @test_address_space_0_1(<2 x i64> addrspace(2)* %a, i16 addrspace(1)* %b) {
+; CHECK-LABEL: @test_address_space_0_1(
+; CHECK-NEXT: [[AA_0_COPYLOAD:%.*]] = load <2 x i64>, <2 x i64> addrspace(2)* [[A:%.*]], align 2
+; CHECK-NEXT: [[AA_0_BPTR_SROA_CAST:%.*]] = bitcast i16 addrspace(1)* [[B:%.*]] to <2 x i64> addrspace(1)*
+; CHECK-NEXT: store <2 x i64> [[AA_0_COPYLOAD]], <2 x i64> addrspace(1)* [[AA_0_BPTR_SROA_CAST]], align 2
+; CHECK-NEXT: ret void
+;
%aa = alloca <2 x i64>, align 16, addrspace(2)
%aptr = bitcast <2 x i64> addrspace(2)* %a to i8 addrspace(2)*
%aaptr = bitcast <2 x i64> addrspace(2)* %aa to i8 addrspace(2)*
@@ -52,9 +58,25 @@ define void @test_address_space_0_1(<2 x i64> addrspace(2)* %a, i16 addrspace(1)
%struct.struct_test_27.0.13 = type { i32, float, i64, i8, [4 x i32] }
-; CHECK-LABEL: @copy_struct(
-; CHECK-NOT: memcpy
define void @copy_struct([5 x i64] %in.coerce, i8 addrspace(1)* align 4 %ptr) {
+; CHECK-LABEL: @copy_struct(
+; CHECK-NEXT: for.end:
+; CHECK-NEXT: [[IN_COERCE_FCA_0_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE:%.*]], 0
+; CHECK-NEXT: [[IN_COERCE_FCA_1_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 1
+; CHECK-NEXT: [[IN_COERCE_FCA_2_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 2
+; CHECK-NEXT: [[IN_COERCE_FCA_3_EXTRACT:%.*]] = extractvalue [5 x i64] [[IN_COERCE]], 3
+; CHECK-NEXT: [[IN_SROA_2_4_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[PTR:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: [[IN_SROA_2_4_EXTRACT_SHIFT:%.*]] = lshr i64 [[IN_COERCE_FCA_2_EXTRACT]], 32
+; CHECK-NEXT: [[IN_SROA_2_4_EXTRACT_TRUNC:%.*]] = trunc i64 [[IN_SROA_2_4_EXTRACT_SHIFT]] to i32
+; CHECK-NEXT: store i32 [[IN_SROA_2_4_EXTRACT_TRUNC]], i32 addrspace(1)* [[IN_SROA_2_4_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: [[IN_SROA_4_20_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[PTR]], i16 4
+; CHECK-NEXT: [[IN_SROA_4_20_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[IN_SROA_4_20_PTR_SROA_IDX]] to i64 addrspace(1)*
+; CHECK-NEXT: store i64 [[IN_COERCE_FCA_3_EXTRACT]], i64 addrspace(1)* [[IN_SROA_4_20_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: [[IN_SROA_5_20_PTR_SROA_IDX:%.*]] = getelementptr inbounds i8, i8 addrspace(1)* [[PTR]], i16 12
+; CHECK-NEXT: [[IN_SROA_5_20_PTR_SROA_CAST:%.*]] = bitcast i8 addrspace(1)* [[IN_SROA_5_20_PTR_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 undef, i32 addrspace(1)* [[IN_SROA_5_20_PTR_SROA_CAST]], align 4
+; CHECK-NEXT: ret void
+;
for.end:
%in = alloca %struct.struct_test_27.0.13, align 8, addrspace(2)
%0 = bitcast %struct.struct_test_27.0.13 addrspace(2)* %in to [5 x i64] addrspace(2)*
@@ -72,10 +94,14 @@ for.end:
; If pointers from
diff erent address spaces have
diff erent sizes, make sure an
; illegal bitcast isn't introduced
-; CHECK-LABEL: @pr27557(
-; CHECK: %[[CAST:.*]] = bitcast i32* addrspace(2)* {{.*}} to i32 addrspace(3)* addrspace(2)*
-; CHECK: store i32 addrspace(3)* @l, i32 addrspace(3)* addrspace(2)* %[[CAST]]
define void @pr27557() {
+; CHECK-LABEL: @pr27557(
+; CHECK-NEXT: [[DOTSROA_0:%.*]] = alloca i32*, align 8, addrspace(2)
+; CHECK-NEXT: store i32* @g, i32* addrspace(2)* [[DOTSROA_0]], align 8
+; CHECK-NEXT: [[DOTSROA_0_0__SROA_CAST1:%.*]] = bitcast i32* addrspace(2)* [[DOTSROA_0]] to i32 addrspace(3)* addrspace(2)*
+; CHECK-NEXT: store i32 addrspace(3)* @l, i32 addrspace(3)* addrspace(2)* [[DOTSROA_0_0__SROA_CAST1]], align 8
+; CHECK-NEXT: ret void
+;
%1 = alloca %union.anon, align 8, addrspace(2)
%2 = bitcast %union.anon addrspace(2)* %1 to i32* addrspace(2)*
store i32* @g, i32* addrspace(2)* %2, align 8
@@ -90,7 +116,8 @@ define void @pr27557() {
; should be promoted through the pair of `ptrtoint`/`inttoptr`.
define i32* @pr27557.alt() {
; CHECK-LABEL: @pr27557.alt(
-; CHECK: ret i32* inttoptr (i64 ptrtoint (i32 addrspace(4)* @l4 to i64) to i32*)
+; CHECK-NEXT: ret i32* inttoptr (i64 ptrtoint (i32 addrspace(4)* @l4 to i64) to i32*)
+;
%1 = alloca %union.anon, align 8, addrspace(2)
%2 = bitcast %union.anon addrspace(2)* %1 to i32 addrspace(4)* addrspace(2)*
store i32 addrspace(4)* @l4, i32 addrspace(4)* addrspace(2)* %2, align 8
@@ -101,12 +128,24 @@ define i32* @pr27557.alt() {
; Test load from and store to non-zero address space.
define void @test_load_store_
diff _addr_space([2 x float] addrspace(1)* %complex1, [2 x float] addrspace(1)* %complex2) {
-; CHECK-LABEL: @test_load_store_
diff _addr_space
-; CHECK-NOT: alloca
-; CHECK: load i32, i32 addrspace(1)*
-; CHECK: load i32, i32 addrspace(1)*
-; CHECK: store i32 %{{.*}}, i32 addrspace(1)*
-; CHECK: store i32 %{{.*}}, i32 addrspace(1)*
+; CHECK-LABEL: @test_load_store_
diff _addr_space(
+; CHECK-NEXT: [[P1_SROA_CAST:%.*]] = bitcast [2 x float] addrspace(1)* [[COMPLEX1:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: [[V15:%.*]] = load i32, i32 addrspace(1)* [[P1_SROA_CAST]], align 4
+; CHECK-NEXT: [[P1_SROA_IDX:%.*]] = getelementptr inbounds [2 x float], [2 x float] addrspace(1)* [[COMPLEX1]], i16 0, i16 1
+; CHECK-NEXT: [[P1_SROA_CAST7:%.*]] = bitcast float addrspace(1)* [[P1_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: [[V18:%.*]] = load i32, i32 addrspace(1)* [[P1_SROA_CAST7]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = bitcast i32 [[V15]] to float
+; CHECK-NEXT: [[TMP2:%.*]] = bitcast i32 [[V18]] to float
+; CHECK-NEXT: [[SUM:%.*]] = fadd float [[TMP1]], [[TMP2]]
+; CHECK-NEXT: [[TMP3:%.*]] = bitcast float [[SUM]] to i32
+; CHECK-NEXT: [[TMP4:%.*]] = bitcast float [[SUM]] to i32
+; CHECK-NEXT: [[P2_SROA_CAST:%.*]] = bitcast [2 x float] addrspace(1)* [[COMPLEX2:%.*]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 [[TMP3]], i32 addrspace(1)* [[P2_SROA_CAST]], align 4
+; CHECK-NEXT: [[P2_SROA_IDX:%.*]] = getelementptr inbounds [2 x float], [2 x float] addrspace(1)* [[COMPLEX2]], i16 0, i16 1
+; CHECK-NEXT: [[P2_SROA_CAST4:%.*]] = bitcast float addrspace(1)* [[P2_SROA_IDX]] to i32 addrspace(1)*
+; CHECK-NEXT: store i32 [[TMP4]], i32 addrspace(1)* [[P2_SROA_CAST4]], align 4
+; CHECK-NEXT: ret void
+;
%a0 = alloca [2 x i64], align 8, addrspace(2)
%a = getelementptr [2 x i64], [2 x i64] addrspace(2)* %a0, i32 0, i32 0
%a.cast = bitcast i64 addrspace(2)* %a to [2 x float] addrspace(2)*
More information about the llvm-commits
mailing list