From 21dab12453d2e9bb222820002890cdd653c59b5f Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 9 Mar 2018 15:20:30 +0000 Subject: [OPENMP] Fix the address of the original variable in task reductions. If initialization of the task reductions requires pointer to original variable, which is stored in the threadprivate storage, we used the address of this pointer instead. llvm-svn: 327136 --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp') diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index f9dab90f398..708f0abd08d 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -5422,6 +5422,9 @@ static llvm::Value *emitReduceInitFunction(CodeGenModule &CGM, CGM.getOpenMPRuntime().getAddrOfArtificialThreadPrivate( CGF, CGM.getContext().VoidPtrTy, generateUniqueName(CGM, "reduction", RCG.getRefExpr(N))); + SharedAddr = CGF.EmitLoadOfPointer( + SharedAddr, + CGM.getContext().VoidPtrTy.castAs()->getTypePtr()); SharedLVal = CGF.MakeAddrLValue(SharedAddr, CGM.getContext().VoidPtrTy); } else { SharedLVal = CGF.MakeNaturalAlignAddrLValue( -- cgit v1.2.3