Skip to content

Commit 980bc06

Browse files
author
Chandra Ghale
committed
conditional checks
1 parent e45c30a commit 980bc06

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5054,9 +5054,15 @@ void CGOpenMPRuntime::emitPrivateReduction(
50545054
CGF.CreateMemTemp(PrivateType, "reduction.temp.result");
50555055
ReturnValueSlot RVS(TempResult, /*IsVolatile=*/false);
50565056
RValue ResultRV = CGF.EmitCallExpr(OpCall, RVS, nullptr);
5057-
CGF.Builder.CreateMemCpy(SharedResult, ResultRV.getAggregateAddress(),
5058-
llvm::ConstantInt::get(CGF.IntPtrTy, 4),
5059-
Alignment.getQuantity());
5057+
if (ResultRV.isAggregate()) {
5058+
CGF.Builder.CreateMemCpy(SharedResult, ResultRV.getAggregateAddress(),
5059+
llvm::ConstantInt::get(CGF.IntPtrTy, 4),
5060+
Alignment.getQuantity());
5061+
} else {
5062+
CGF.Builder.CreateStore(ResultRV.getScalarVal(),
5063+
SharedLV.getAddress(),
5064+
/*IsVolatile=*/false);
5065+
}
50605066
};
50615067
std::string CriticalName = getName({"reduction_critical"});
50625068
emitCriticalRegion(CGF, CriticalName, ReductionGen, Loc);

0 commit comments

Comments
 (0)