Skip to content

Commit 4e6eea6

Browse files
author
Chandra Ghale
committed
review comment changes incorporated
1 parent a05af19 commit 4e6eea6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4981,7 +4981,8 @@ void CGOpenMPRuntime::emitPrivateReduction(
49814981
CGM.getModule(), OMPRTL___kmpc_barrier),
49824982
BarrierArgs);
49834983

4984-
for (unsigned I = 0; I < ReductionOps.size(); ++I) {
4984+
for (unsigned I :
4985+
llvm::seq<unsigned>(std::min(ReductionOps.size(), LHSExprs.size()))) {
49854986
if (I >= LHSExprs.size()) {
49864987
break;
49874988
}
@@ -5003,7 +5004,7 @@ void CGOpenMPRuntime::emitPrivateReduction(
50035004
LValue SharedLV = CGF.MakeAddrLValue(SharedResult, PrivateType);
50045005
LValue LHSLV = CGF.EmitLValue(LHSExprs[I]);
50055006
RValue PrivateRV = CGF.EmitLoadOfLValue(LHSLV, Loc);
5006-
auto &&UpdateOp = [&CGF, PrivateRV, BinOp, BO](RValue OldVal) {
5007+
auto UpdateOp = [&](RValue OldVal) {
50075008
if (BO == BO_Mul) {
50085009
llvm::Value *OldScalar = OldVal.getScalarVal();
50095010
llvm::Value *PrivateScalar = PrivateRV.getScalarVal();
@@ -5032,7 +5033,7 @@ void CGOpenMPRuntime::emitPrivateReduction(
50325033
llvm::Value *FinalResult = CGF.Builder.CreateLoad(SharedResult);
50335034

50345035
// Update private variables with final result
5035-
for (unsigned I = 0; I < Privates.size(); ++I) {
5036+
for (unsigned I : llvm::seq<unsigned>(Privates.size())) {
50365037
LValue LHSLV = CGF.EmitLValue(LHSExprs[I]);
50375038
CGF.Builder.CreateStore(FinalResult, LHSLV.getAddress());
50385039
}
@@ -5345,9 +5346,8 @@ void CGOpenMPRuntime::emitReduction(CodeGenFunction &CGF, SourceLocation Loc,
53455346

53465347
CGF.EmitBranch(DefaultBB);
53475348
CGF.EmitBlock(DefaultBB, /*IsFinished=*/true);
5348-
if (Options.IsPrivateVarReduction) {
5349+
if (Options.IsPrivateVarReduction)
53495350
emitPrivateReduction(CGF, Loc, Privates, LHSExprs, RHSExprs, ReductionOps);
5350-
}
53515351
}
53525352

53535353
/// Generates unique name for artificial threadprivate variables.

0 commit comments

Comments
 (0)