forked from OSchip/llvm-project
[OPENMP] Fix stack use after delete, NFC.
Fixed possible use of stack variable after deletion. llvm-svn: 287025
This commit is contained in:
parent
35f5aab4d7
commit
ba002163c9
|
@ -2237,6 +2237,7 @@ void CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
|
||||||
bool HasLastprivates = false;
|
bool HasLastprivates = false;
|
||||||
auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
|
auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
|
||||||
PrePostActionTy &) {
|
PrePostActionTy &) {
|
||||||
|
OMPCancelStackRAII CancelRegion(CGF);
|
||||||
auto &C = CGF.CGM.getContext();
|
auto &C = CGF.CGM.getContext();
|
||||||
auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
|
auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
|
||||||
// Emit helper vars inits.
|
// Emit helper vars inits.
|
||||||
|
@ -2332,11 +2333,11 @@ void CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
|
||||||
[](CodeGenFunction &) {});
|
[](CodeGenFunction &) {});
|
||||||
// Tell the runtime we are done.
|
// Tell the runtime we are done.
|
||||||
SourceLocation ELoc = S.getLocEnd();
|
SourceLocation ELoc = S.getLocEnd();
|
||||||
auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
|
auto &&FinalCodeGen = [ELoc](CodeGenFunction &CGF) {
|
||||||
CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
|
CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
|
||||||
};
|
};
|
||||||
CodeGen(CGF);
|
FinalCodeGen(CGF);
|
||||||
CGF.OMPCancelStack.back().CodeGen = CodeGen;
|
CGF.OMPCancelStack.back().CodeGen = FinalCodeGen;
|
||||||
CGF.EmitOMPReductionClauseFinal(S);
|
CGF.EmitOMPReductionClauseFinal(S);
|
||||||
// Emit post-update of the reduction variables if IsLastIter != 0.
|
// Emit post-update of the reduction variables if IsLastIter != 0.
|
||||||
emitPostUpdateForReductionClause(
|
emitPostUpdateForReductionClause(
|
||||||
|
@ -2374,7 +2375,6 @@ void CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
|
||||||
void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
|
void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
|
||||||
{
|
{
|
||||||
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
|
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
|
||||||
OMPCancelStackRAII CancelRegion(*this);
|
|
||||||
EmitSections(S);
|
EmitSections(S);
|
||||||
}
|
}
|
||||||
// Emit an implicit barrier at the end.
|
// Emit an implicit barrier at the end.
|
||||||
|
@ -2483,7 +2483,6 @@ void CodeGenFunction::EmitOMPParallelSectionsDirective(
|
||||||
// Emit directive as a combined directive that consists of two implicit
|
// Emit directive as a combined directive that consists of two implicit
|
||||||
// directives: 'parallel' with 'sections' directive.
|
// directives: 'parallel' with 'sections' directive.
|
||||||
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
|
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
|
||||||
OMPCancelStackRAII CancelRegion(CGF);
|
|
||||||
CGF.EmitSections(S);
|
CGF.EmitSections(S);
|
||||||
};
|
};
|
||||||
emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);
|
emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);
|
||||||
|
|
Loading…
Reference in New Issue