Skip to content

Commit 59f4592

Browse files
authored
[SYCL] Remove ASFixer and DISABLE_INFER_AS support (#893)
Signed-off-by: Vlad Romanov <[email protected]>
1 parent de418d6 commit 59f4592

28 files changed

+118
-1174
lines changed

clang/lib/Basic/Targets/SPIR.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public TargetInfo {
6464
TLSSupported = false;
6565
VLASupported = false;
6666
LongWidth = LongAlign = 64;
67-
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice &&
68-
!getenv("DISABLE_INFER_AS")) {
67+
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice) {
6968
AddrSpaceMap = &SYCLAddrSpaceMap;
7069
} else {
7170
AddrSpaceMap = &SPIRAddrSpaceMap;

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "llvm/Passes/PassBuilder.h"
4040
#include "llvm/Passes/PassPlugin.h"
4141
#include "llvm/Passes/StandardInstrumentations.h"
42-
#include "llvm/SYCL/ASFixer.h"
4342
#include "llvm/Support/BuryPointer.h"
4443
#include "llvm/Support/CommandLine.h"
4544
#include "llvm/Support/Debug.h"
@@ -854,8 +853,6 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
854853

855854
case Backend_EmitBC:
856855
if (LangOpts.SYCLIsDevice) {
857-
if (getenv("DISABLE_INFER_AS"))
858-
PerModulePasses.add(createASFixerPass());
859856
PerModulePasses.add(createDeadCodeEliminationPass());
860857
}
861858
if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {
@@ -1282,8 +1279,6 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
12821279

12831280
case Backend_EmitBC:
12841281
if (LangOpts.SYCLIsDevice) {
1285-
if (getenv("DISABLE_INFER_AS"))
1286-
CodeGenPasses.add(createASFixerPass());
12871282
CodeGenPasses.add(createDeadCodeEliminationPass());
12881283
}
12891284
if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) {

clang/lib/CodeGen/CGCall.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4316,17 +4316,15 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
43164316
deactivateArgCleanupsBeforeCall(*this, CallArgs);
43174317

43184318
// Addrspace cast to generic if necessary
4319-
if (!getenv("DISABLE_INFER_AS")) {
4320-
for (unsigned i = 0; i < IRFuncTy->getNumParams(); ++i) {
4321-
if (auto *PtrTy = dyn_cast<llvm::PointerType>(IRCallArgs[i]->getType())) {
4322-
auto *ExpectedPtrType =
4323-
cast<llvm::PointerType>(IRFuncTy->getParamType(i));
4324-
unsigned ValueAS = PtrTy->getAddressSpace();
4325-
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
4326-
if (ValueAS != ExpectedAS) {
4327-
IRCallArgs[i] = Builder.CreatePointerBitCastOrAddrSpaceCast(
4328-
IRCallArgs[i], ExpectedPtrType);
4329-
}
4319+
for (unsigned i = 0; i < IRFuncTy->getNumParams(); ++i) {
4320+
if (auto *PtrTy = dyn_cast<llvm::PointerType>(IRCallArgs[i]->getType())) {
4321+
auto *ExpectedPtrType =
4322+
cast<llvm::PointerType>(IRFuncTy->getParamType(i));
4323+
unsigned ValueAS = PtrTy->getAddressSpace();
4324+
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
4325+
if (ValueAS != ExpectedAS) {
4326+
IRCallArgs[i] = Builder.CreatePointerBitCastOrAddrSpaceCast(
4327+
IRCallArgs[i], ExpectedPtrType);
43304328
}
43314329
}
43324330
}

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,16 +1748,14 @@ void CodeGenFunction::EmitStoreOfScalar(llvm::Value *Value, Address Addr,
17481748
return;
17491749
}
17501750

1751-
if (!getenv("DISABLE_INFER_AS")) {
1752-
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Value->getType())) {
1753-
auto *ExpectedPtrType =
1754-
cast<llvm::PointerType>(Addr.getType()->getElementType());
1755-
unsigned ValueAS = PtrTy->getAddressSpace();
1756-
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1757-
if (ValueAS != ExpectedAS) {
1758-
Value =
1759-
Builder.CreatePointerBitCastOrAddrSpaceCast(Value, ExpectedPtrType);
1760-
}
1751+
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Value->getType())) {
1752+
auto *ExpectedPtrType =
1753+
cast<llvm::PointerType>(Addr.getType()->getElementType());
1754+
unsigned ValueAS = PtrTy->getAddressSpace();
1755+
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1756+
if (ValueAS != ExpectedAS) {
1757+
Value =
1758+
Builder.CreatePointerBitCastOrAddrSpaceCast(Value, ExpectedPtrType);
17611759
}
17621760
}
17631761
llvm::StoreInst *Store = Builder.CreateStore(Value, Addr, Volatile);

clang/lib/CodeGen/CGStmt.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,16 +1110,13 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
11101110
// rather than the value.
11111111
RValue Result = EmitReferenceBindingToExpr(RV);
11121112
llvm::Value *Val = Result.getScalarVal();
1113-
if (!getenv("DISABLE_INFER_AS")) {
1114-
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Val->getType())) {
1115-
auto *ExpectedPtrType =
1116-
cast<llvm::PointerType>(ReturnValue.getType()->getElementType());
1117-
unsigned ValueAS = PtrTy->getAddressSpace();
1118-
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1119-
if (ValueAS != ExpectedAS) {
1120-
Val =
1121-
Builder.CreatePointerBitCastOrAddrSpaceCast(Val, ExpectedPtrType);
1122-
}
1113+
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Val->getType())) {
1114+
auto *ExpectedPtrType =
1115+
cast<llvm::PointerType>(ReturnValue.getType()->getElementType());
1116+
unsigned ValueAS = PtrTy->getAddressSpace();
1117+
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1118+
if (ValueAS != ExpectedAS) {
1119+
Val = Builder.CreatePointerBitCastOrAddrSpaceCast(Val, ExpectedPtrType);
11231120
}
11241121
}
11251122
Builder.CreateStore(Val, ReturnValue);
@@ -1128,16 +1125,14 @@ void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) {
11281125
case TEK_Scalar:
11291126
{
11301127
llvm::Value *Val = EmitScalarExpr(RV);
1131-
if (!getenv("DISABLE_INFER_AS")) {
1132-
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Val->getType())) {
1133-
auto *ExpectedPtrType =
1134-
cast<llvm::PointerType>(ReturnValue.getType()->getElementType());
1135-
unsigned ValueAS = PtrTy->getAddressSpace();
1136-
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1137-
if (ValueAS != ExpectedAS) {
1138-
Val = Builder.CreatePointerBitCastOrAddrSpaceCast(
1139-
Val, ExpectedPtrType);
1140-
}
1128+
if (auto *PtrTy = dyn_cast<llvm::PointerType>(Val->getType())) {
1129+
auto *ExpectedPtrType =
1130+
cast<llvm::PointerType>(ReturnValue.getType()->getElementType());
1131+
unsigned ValueAS = PtrTy->getAddressSpace();
1132+
unsigned ExpectedAS = ExpectedPtrType->getAddressSpace();
1133+
if (ValueAS != ExpectedAS) {
1134+
Val =
1135+
Builder.CreatePointerBitCastOrAddrSpaceCast(Val, ExpectedPtrType);
11411136
}
11421137
}
11431138
Builder.CreateStore(Val, ReturnValue);

clang/lib/CodeGen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ set(LLVM_LINK_COMPONENTS
2424
Support
2525
Target
2626
TransformUtils
27-
ASFixer
2827
)
2928

3029
# In a standard Clang+LLVM build, we need to generate intrinsics before

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3775,10 +3775,8 @@ LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) {
37753775

37763776
if (Scope && Scope->isWorkGroup())
37773777
return LangAS::opencl_local;
3778-
if (!getenv("DISABLE_INFER_AS")) {
3779-
if (!D || D->getType().getAddressSpace() == LangAS::Default) {
3780-
return LangAS::opencl_global;
3781-
}
3778+
if (!D || D->getType().getAddressSpace() == LangAS::Default) {
3779+
return LangAS::opencl_global;
37823780
}
37833781
}
37843782

@@ -3807,7 +3805,7 @@ LangAS CodeGenModule::getStringLiteralAddressSpace() const {
38073805
// OpenCL v1.2 s6.5.3: a string literal is in the constant address space.
38083806
if (LangOpts.OpenCL)
38093807
return LangAS::opencl_constant;
3810-
if (LangOpts.SYCLIsDevice && !getenv("DISABLE_INFER_AS"))
3808+
if (LangOpts.SYCLIsDevice)
38113809
// If we keep a literal string in constant address space, the following code
38123810
// becomes illegal:
38133811
//

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,8 +1089,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
10891089
if (LangOpts.SYCLIsDevice) {
10901090
Builder.defineMacro("__SYCL_DEVICE_ONLY__", "1");
10911091
Builder.defineMacro("SYCL_EXTERNAL", "__attribute__((sycl_device))");
1092-
if (!getenv("DISABLE_INFER_AS"))
1093-
Builder.defineMacro("__SYCL_ENABLE_INFER_AS__", "1");
10941092
}
10951093
if (LangOpts.SYCLUnnamedLambda)
10961094
Builder.defineMacro("__SYCL_UNNAMED_LAMBDA__", "1");
Lines changed: 30 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// RUN: DISABLE_INFER_AS=1 %clang_cc1 -triple spir64-unknown-linux-sycldevice -std=c++11 -fsycl-is-device -disable-llvm-passes -emit-llvm -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
2-
// RUN: %clang_cc1 -triple spir64-unknown-linux-sycldevice -std=c++11 -fsycl-is-device -disable-llvm-passes -emit-llvm -x c++ %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NEW
1+
// RUN: %clang_cc1 -triple spir64-unknown-linux-sycldevice -std=c++11 -fsycl-is-device -disable-llvm-passes -emit-llvm -x c++ %s -o - | FileCheck %s
32

43
struct SpaceWaster {
54
int i, j;
@@ -19,8 +18,7 @@ void baz(Y &y) {
1918

2019
void test() {
2120
static const int foo = 0x42;
22-
// CHECK-LEGACY: @_ZZ4testvE3foo = internal constant i32 66, align 4
23-
// CHECK-NEW: @_ZZ4testvE3foo = internal addrspace(1) constant i32 66, align 4
21+
// CHECK: @_ZZ4testvE3foo = internal addrspace(1) constant i32 66, align 4
2422

2523
// Intentionally leave a part of an array uninitialized. This triggers a
2624
// different code path contrary to a fully initialized array.
@@ -29,60 +27,49 @@ void test() {
2927
11, 12, 13, 14, 15, 16, 17, 18, 19, 20
3028
};
3129
(void)bars;
32-
// CHECK-LEGACY: @_ZZ4testvE4bars = internal constant <{ [21 x i32], [235 x i32] }> <{ [21 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20], [235 x i32] zeroinitializer }>, align 4
33-
// CHECK-NEW: @_ZZ4testvE4bars = internal addrspace(1) constant <{ [21 x i32], [235 x i32] }> <{ [21 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20], [235 x i32] zeroinitializer }>, align 4
30+
// CHECK: @_ZZ4testvE4bars = internal addrspace(1) constant <{ [21 x i32], [235 x i32] }> <{ [21 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20], [235 x i32] zeroinitializer }>, align 4
3431

3532
// CHECK: @[[STR:[.a-zA-Z0-9_]+]] = private unnamed_addr constant [14 x i8] c"Hello, world!\00", align 1
3633

37-
// CHECK-NEW: %i.ascast = addrspacecast i32* %i to i32 addrspace(4)*
34+
// CHECK: %i.ascast = addrspacecast i32* %i to i32 addrspace(4)*
3835
// CHECK: %[[ARR:[a-zA-Z0-9]+]] = alloca [42 x i32]
3936

4037
int i = 0;
4138
int *pptr = &i;
42-
// CHECK-LEGACY: store i32* %i, i32** %pptr
43-
// CHECK-NEW: %[[GEN:[0-9]+]] = addrspacecast i32* %i to i32 addrspace(4)*
44-
// CHECK-NEW: store i32 addrspace(4)* %[[GEN]], i32 addrspace(4)** %pptr
39+
// CHECK: %[[GEN:[0-9]+]] = addrspacecast i32* %i to i32 addrspace(4)*
40+
// CHECK: store i32 addrspace(4)* %[[GEN]], i32 addrspace(4)** %pptr
4541
bool is_i_ptr = (pptr == &i);
46-
// CHECK-LEGACY: %[[VALPPTR:[0-9]+]] = load i32*, i32** %pptr
47-
// CHECK-LEGACY: %cmp{{[0-9]*}} = icmp eq i32* %[[VALPPTR]], %i
48-
// CHECK-NEW: %[[VALPPTR:[0-9]+]] = load i32 addrspace(4)*, i32 addrspace(4)** %pptr
49-
// CHECK-NEW: %cmp{{[0-9]*}} = icmp eq i32 addrspace(4)* %[[VALPPTR]], %i.ascast
42+
// CHECK: %[[VALPPTR:[0-9]+]] = load i32 addrspace(4)*, i32 addrspace(4)** %pptr
43+
// CHECK: %cmp{{[0-9]*}} = icmp eq i32 addrspace(4)* %[[VALPPTR]], %i.ascast
5044
*pptr = foo;
5145

5246
int var23 = 23;
5347
char *cp = (char *)&var23;
5448
*cp = 41;
5549
// CHECK: store i32 23, i32* %[[VAR:[a-zA-Z0-9]+]]
56-
// CHECK-LEGACY: [[VARCAST:[a-zA-Z0-9]+]] = bitcast i32* %[[VAR]] to i8*
57-
// CHECK-LEGACY: store i8* %[[VARCAST]], i8** %{{.*}}
58-
// CHECK-NEW: [[VARAS:[a-zA-Z0-9]+]] = addrspacecast i32* %[[VAR]] to i32 addrspace(4)*
59-
// CHECK-NEW: [[VARCAST:[a-zA-Z0-9]+]] = bitcast i32 addrspace(4)* %[[VARAS]] to i8 addrspace(4)*
60-
// CHECK-NEW: store i8 addrspace(4)* %[[VARCAST]], i8 addrspace(4)** %{{.*}}
50+
// CHECK: [[VARAS:[a-zA-Z0-9]+]] = addrspacecast i32* %[[VAR]] to i32 addrspace(4)*
51+
// CHECK: [[VARCAST:[a-zA-Z0-9]+]] = bitcast i32 addrspace(4)* %[[VARAS]] to i8 addrspace(4)*
52+
// CHECK: store i8 addrspace(4)* %[[VARCAST]], i8 addrspace(4)** %{{.*}}
6153

6254
int arr[42];
6355
char *cpp = (char *)arr;
6456
*cpp = 43;
6557
// CHECK: %[[ARRDECAY:[a-zA-Z0-9]+]] = getelementptr inbounds [42 x i32], [42 x i32]* %[[ARR]], i64 0, i64 0
66-
// CHECK-LEGACY: [[ARRCAST:[a-zA-Z0-9]+]] = bitcast i32* %[[ARRDECAY]] to i8*
67-
// CHECK-LEGACY: store i8* %[[ARRCAST]], i8** %{{.*}}
68-
// CHECK-NEW: %[[ARRAS:[a-zA-Z0-9]+]] = addrspacecast i32* %[[ARRDECAY]] to i32 addrspace(4)*
69-
// CHECK-NEW: %[[ARRCAST:[a-zA-Z0-9]+]] = bitcast i32 addrspace(4)* %[[ARRAS]] to i8 addrspace(4)*
70-
// CHECK-NEW: store i8 addrspace(4)* %[[ARRCAST]], i8 addrspace(4)** %{{.*}}
58+
// CHECK: %[[ARRAS:[a-zA-Z0-9]+]] = addrspacecast i32* %[[ARRDECAY]] to i32 addrspace(4)*
59+
// CHECK: %[[ARRCAST:[a-zA-Z0-9]+]] = bitcast i32 addrspace(4)* %[[ARRAS]] to i8 addrspace(4)*
60+
// CHECK: store i8 addrspace(4)* %[[ARRCAST]], i8 addrspace(4)** %{{.*}}
7161

7262
int *aptr = arr + 10;
7363
if (aptr < arr + sizeof(arr))
7464
*aptr = 44;
75-
// CHECK-LEGACY: %[[VALAPTR:[0-9]+]] = load i32*, i32** %aptr
76-
// CHECK-NEW: %[[VALAPTR:[0-9]+]] = load i32 addrspace(4)*, i32 addrspace(4)** %aptr
65+
// CHECK: %[[VALAPTR:[0-9]+]] = load i32 addrspace(4)*, i32 addrspace(4)** %aptr
7766
// CHECK: %[[ARRDCY2:[a-zA-Z0-9]+]] = getelementptr inbounds [42 x i32], [42 x i32]* %[[ARR]], i64 0, i64 0
7867
// CHECK: %[[ADDPTR:[a-zA-Z0-9.]+]] = getelementptr inbounds i32, i32* %[[ARRDCY2]], i64 168
79-
// CHECK-LEGACY: %cmp{{[0-9]+}} = icmp ult i32* %[[VALAPTR]], %[[ADDPTR]]
80-
// CHECK-NEW: %[[ADDPTRCAST:[a-zA-Z0-9.]+]] = addrspacecast i32* %[[ADDPTR]] to i32 addrspace(4)*
81-
// CHECK-NEW: %cmp{{[0-9]+}} = icmp ult i32 addrspace(4)* %[[VALAPTR]], %[[ADDPTRCAST]]
68+
// CHECK: %[[ADDPTRCAST:[a-zA-Z0-9.]+]] = addrspacecast i32* %[[ADDPTR]] to i32 addrspace(4)*
69+
// CHECK: %cmp{{[0-9]+}} = icmp ult i32 addrspace(4)* %[[VALAPTR]], %[[ADDPTRCAST]]
8270

8371
const char *str = "Hello, world!";
84-
// CHECK-LEGACY: store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @[[STR]], i64 0, i64 0), i8** %[[STRVAL:[a-zA-Z0-9]+]], align 8
85-
// CHECK-NEW: store i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([14 x i8], [14 x i8]* @[[STR]], i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)** %[[STRVAL:[a-zA-Z0-9]+]], align 8
72+
// CHECK: store i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([14 x i8], [14 x i8]* @[[STR]], i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)** %[[STRVAL:[a-zA-Z0-9]+]], align 8
8673

8774
i = str[0];
8875

@@ -92,48 +79,35 @@ void test() {
9279
// CHECK: br i1 %[[COND]], label %[[CONDTRUE:[.a-zA-Z0-9]+]], label %[[CONDFALSE:[.a-zA-Z0-9]+]]
9380

9481
// CHECK: [[CONDTRUE]]:
95-
// CHECK-LEGACY-NEXT: %[[VALTRUE:[a-zA-Z0-9]+]] = load i8*, i8** %[[STRVAL]]
96-
// CHECK-LEGACY-NEXT: br label %[[CONDEND:[.a-zA-Z0-9]+]]
97-
// CHECK-NEW-NEXT: %[[VALTRUE:[a-zA-Z0-9]+]] = load i8 addrspace(4)*, i8 addrspace(4)** %[[STRVAL]]
98-
// CHECK-NEW-NEXT: br label %[[CONDEND:[.a-zA-Z0-9]+]]
82+
// CHECK-NEXT: %[[VALTRUE:[a-zA-Z0-9]+]] = load i8 addrspace(4)*, i8 addrspace(4)** %[[STRVAL]]
83+
// CHECK-NEXT: br label %[[CONDEND:[.a-zA-Z0-9]+]]
9984

10085
// CHECK: [[CONDFALSE]]:
101-
// CHECK-LEGACY-NEXT: br label %[[CONDEND]]
10286

103-
// CHECK-LEGACY: [[CONDEND]]:
104-
// CHECK-NEW: [[CONDEND]]:
105-
// CHECK-NEW-NEXT: phi i8 addrspace(4)* [ %[[VALTRUE]], %[[CONDTRUE]] ], [ addrspacecast (i8* getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), %[[CONDFALSE]] ]
106-
// CHECK-LEGACY-NEXT: phi i8* [ %[[VALTRUE]], %[[CONDTRUE]] ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0), %[[CONDFALSE]] ]
87+
// CHECK: [[CONDEND]]:
88+
// CHECK-NEXT: phi i8 addrspace(4)* [ %[[VALTRUE]], %[[CONDTRUE]] ], [ addrspacecast (i8* getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), %[[CONDFALSE]] ]
10789

10890
const char *select_null = i > 2 ? "Yet another Hello world" : nullptr;
10991
(void)select_null;
110-
// CHECK-LEGACY: select i1 %{{.*}}, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @{{.*}}, i64 0, i64 0), i8* null
111-
// CHECK-NEW: select i1 %{{.*}}, i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([24 x i8], [24 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)* null
92+
// CHECK: select i1 %{{.*}}, i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([24 x i8], [24 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)* null
11293

11394
const char *select_str_trivial1 = true ? str : "Another hello world!";
11495
(void)select_str_trivial1;
115-
// CHECK-LEGACY: %[[TRIVIALTRUE:[a-zA-Z0-9]+]] = load i8*, i8** %[[STRVAL]]
116-
// CHECK-LEGACY: store i8* %[[TRIVIALTRUE]], i8** %{{.*}}, align 8
117-
// CHECK-NEW: %[[TRIVIALTRUE:[a-zA-Z0-9]+]] = load i8 addrspace(4)*, i8 addrspace(4)** %[[STRVAL]]
118-
// CHECK-NEW: store i8 addrspace(4)* %[[TRIVIALTRUE]], i8 addrspace(4)** %{{.*}}, align 8
96+
// CHECK: %[[TRIVIALTRUE:[a-zA-Z0-9]+]] = load i8 addrspace(4)*, i8 addrspace(4)** %[[STRVAL]]
97+
// CHECK: store i8 addrspace(4)* %[[TRIVIALTRUE]], i8 addrspace(4)** %{{.*}}, align 8
11998

12099
const char *select_str_trivial2 = false ? str : "Another hello world!";
121100
(void)select_str_trivial2;
122-
// CHECK-LEGACY: store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0), i8** %{{.*}}
123-
// CHECK-NEW: store i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)** %{{.*}}
101+
// CHECK: store i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([21 x i8], [21 x i8]* @{{.*}}, i64 0, i64 0) to i8 addrspace(4)*), i8 addrspace(4)** %{{.*}}
124102
//
125103
//
126104
Y yy;
127105
baz(yy);
128106
// CHECK: define spir_func void @{{.*}}baz{{.*}}
129-
// CHECK-LEGACY: %[[FIRST:[a-zA-Z0-9]+]] = bitcast %struct.{{.*}}.Y* %{{.*}} to i8*
130-
// CHECK-LEGACY: %[[OFFSET:[a-zA-Z0-9]+]].ptr = getelementptr inbounds i8, i8* %[[FIRST]], i64 8
131-
// CHECK-LEGACY: %[[SECOND:[a-zA-Z0-9]+]] = bitcast i8* %[[OFFSET]].ptr to %struct.{{.*}}.HasX*
132-
// CHECK-LEGACY: call spir_func void @{{.*}}bar{{.*}}(%struct.{{.*}}.HasX* dereferenceable(4) %[[SECOND]])
133-
// CHECK-NEW: %[[FIRST:[a-zA-Z0-9]+]] = bitcast %struct.{{.*}}.Y addrspace(4)* %{{.*}} to i8 addrspace(4)*
134-
// CHECK-NEW: %[[OFFSET:[a-zA-Z0-9]+]].ptr = getelementptr inbounds i8, i8 addrspace(4)* %[[FIRST]], i64 8
135-
// CHECK-NEW: %[[SECOND:[a-zA-Z0-9]+]] = bitcast i8 addrspace(4)* %[[OFFSET]].ptr to %struct.{{.*}}.HasX addrspace(4)*
136-
// CHECK-NEW: call spir_func void @{{.*}}bar{{.*}}(%struct.{{.*}}.HasX addrspace(4)* dereferenceable(4) %[[SECOND]])
107+
// CHECK: %[[FIRST:[a-zA-Z0-9]+]] = bitcast %struct.{{.*}}.Y addrspace(4)* %{{.*}} to i8 addrspace(4)*
108+
// CHECK: %[[OFFSET:[a-zA-Z0-9]+]].ptr = getelementptr inbounds i8, i8 addrspace(4)* %[[FIRST]], i64 8
109+
// CHECK: %[[SECOND:[a-zA-Z0-9]+]] = bitcast i8 addrspace(4)* %[[OFFSET]].ptr to %struct.{{.*}}.HasX addrspace(4)*
110+
// CHECK: call spir_func void @{{.*}}bar{{.*}}(%struct.{{.*}}.HasX addrspace(4)* dereferenceable(4) %[[SECOND]])
137111
}
138112

139113

@@ -147,6 +121,3 @@ int main() {
147121
kernel_single_task<class fake_kernel>([]() { test(); });
148122
return 0;
149123
}
150-
151-
// TODO: SYCL specific fail - analyze and enable
152-
// XFAIL: windows-msvc

0 commit comments

Comments
 (0)