File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -3302,6 +3302,7 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
33023302 CharUnits Align = CGM.getContext ().getDeclAlign (VD);
33033303 Val = Builder.CreateAlignedLoad (Var->getValueType (), Val, Align);
33043304 }
3305+ Val = Builder.CreateAddrSpaceCast (Val, Wrapper->getReturnType ());
33053306
33063307 Builder.CreateRet (Val);
33073308 }
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -target-cpu gfx906 -fopenmp -nogpulib -fopenmp-is-target-device -emit-llvm %s -o - | FileCheck %s
2+
3+ // Don't crash with assertions build.
4+
5+ // CHECK: @MyGlobVar = external thread_local addrspace(1) global i32, align 4
6+ // CHECK: define weak_odr hidden noundef ptr @_ZTW9MyGlobVar() #0 comdat {
7+ // CHECK-NEXT: %1 = call align 4 ptr addrspace(1) @llvm.threadlocal.address.p1(ptr addrspace(1) align 4 @MyGlobVar)
8+ // CHECK-NEXT: %2 = addrspacecast ptr addrspace(1) %1 to ptr
9+ // CHECK-NEXT: ret ptr %2
10+ // CHECK-NEXT: }
11+ int MyGlobVar;
12+ #pragma omp threadprivate(MyGlobVar)
13+ int main () {
14+ MyGlobVar = 1 ;
15+ }
16+
You can’t perform that action at this time.
0 commit comments