Skip to content

Commit 84d1236

Browse files
authored
[SYCL][SYCLLowerWGLocalMemoryPass] replace undef with poison (#16960)
This fixes "error: undef deprecator failed" in pre-commit test of #16356
1 parent 84afbfa commit 84d1236

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

llvm/lib/SYCLLowerIR/LowerWGLocalMemory.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ static void lowerAllocaLocalMemCall(CallInst *CI, Module &M) {
109109
unsigned LocalAS =
110110
CI->getFunctionType()->getReturnType()->getPointerAddressSpace();
111111
auto *LocalMemArrayGV =
112-
new GlobalVariable(M, // module
113-
LocalMemArrayTy, // type
114-
false, // isConstant
115-
GlobalValue::InternalLinkage, // Linkage
116-
UndefValue::get(LocalMemArrayTy), // Initializer
117-
LOCALMEMORY_GV_PREF, // Name prefix
118-
nullptr, // InsertBefore
119-
GlobalVariable::NotThreadLocal, // ThreadLocalMode
120-
LocalAS // AddressSpace
112+
new GlobalVariable(M, // module
113+
LocalMemArrayTy, // type
114+
false, // isConstant
115+
GlobalValue::InternalLinkage, // Linkage
116+
PoisonValue::get(LocalMemArrayTy), // Initializer
117+
LOCALMEMORY_GV_PREF, // Name prefix
118+
nullptr, // InsertBefore
119+
GlobalVariable::NotThreadLocal, // ThreadLocalMode
120+
LocalAS // AddressSpace
121121
);
122122
LocalMemArrayGV->setAlignment(Align(Alignment));
123123

@@ -203,7 +203,7 @@ static bool dynamicWGLocalMemory(Module &M) {
203203
usesKernelArgForDynWGLocalMem(TT)
204204
? GlobalValue::LinkOnceODRLinkage
205205
: GlobalValue::ExternalLinkage, // Linkage
206-
usesKernelArgForDynWGLocalMem(TT) ? UndefValue::get(LocalMemArrayTy)
206+
usesKernelArgForDynWGLocalMem(TT) ? PoisonValue::get(LocalMemArrayTy)
207207
: nullptr, // Initializer
208208
DYNAMIC_LOCALMEM_GV, // Name prefix
209209
nullptr, // InsertBefore

llvm/test/SYCLLowerIR/group_local_memory.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
; RUN: opt -S -sycllowerwglocalmemory -bugpoint-enable-legacy-pm < %s | FileCheck %s
22
; RUN: opt -S -passes=sycllowerwglocalmemory < %s | FileCheck %s
33

4-
; CHECK-DAG: [[WGLOCALMEM_1:@WGLocalMem.*]] = internal addrspace(3) global [128 x i8] undef, align 4
5-
; CHECK-DAG: [[WGLOCALMEM_2:@WGLocalMem.*]] = internal addrspace(3) global [4 x i8] undef, align 4
6-
; CHECK-DAG: [[WGLOCALMEM_3:@WGLocalMem.*]] = internal addrspace(3) global [256 x i8] undef, align 8
4+
; CHECK-DAG: [[WGLOCALMEM_1:@WGLocalMem.*]] = internal addrspace(3) global [128 x i8] poison, align 4
5+
; CHECK-DAG: [[WGLOCALMEM_2:@WGLocalMem.*]] = internal addrspace(3) global [4 x i8] poison, align 4
6+
; CHECK-DAG: [[WGLOCALMEM_3:@WGLocalMem.*]] = internal addrspace(3) global [256 x i8] poison, align 8
77

88
; CHECK-NOT: __sycl_allocateLocalMemory
99

llvm/test/SYCLLowerIR/work_group_static.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
77
target triple = "spir64-unknown-unknown"
88

9-
; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = linkonce_odr local_unnamed_addr addrspace(3) global ptr addrspace(3) undef
9+
; CHECK: @__sycl_dynamicLocalMemoryPlaceholder_GV = linkonce_odr local_unnamed_addr addrspace(3) global ptr addrspace(3) poison
1010

1111
; Function Attrs: convergent norecurse
1212
; CHECK: @_ZTS7KernelA(ptr addrspace(1) %0, ptr addrspace(3) noalias "sycl-implicit-local-arg" %[[IMPLICT_ARG:[a-zA-Z0-9]+]]{{.*}} !kernel_arg_addr_space ![[ADDR_SPACE_MD:[0-9]+]]

0 commit comments

Comments
 (0)