forked from OSchip/llvm-project
[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
This commit is contained in:
parent
14b7e18909
commit
21dab12453
|
@ -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<PointerType>()->getTypePtr());
|
||||
SharedLVal = CGF.MakeAddrLValue(SharedAddr, CGM.getContext().VoidPtrTy);
|
||||
} else {
|
||||
SharedLVal = CGF.MakeNaturalAlignAddrLValue(
|
||||
|
|
|
@ -164,7 +164,9 @@ sum = 0.0;
|
|||
|
||||
// CHECK: define internal void @[[RED_INIT2]](i8*)
|
||||
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
||||
// CHECK: call i8* @__kmpc_threadprivate_cached(
|
||||
// CHECK: [[ORIG_PTR_ADDR:%.+]] = call i8* @__kmpc_threadprivate_cached(
|
||||
// CHECK: [[ORIG_PTR_REF:%.+]] = bitcast i8* [[ORIG_PTR_ADDR]] to i8**
|
||||
// CHECK: load i8*, i8** [[ORIG_PTR_REF]],
|
||||
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(
|
||||
// CHECK: ret void
|
||||
|
||||
|
|
Loading…
Reference in New Issue