Skip to content

Commit b936f2c

Browse files
committed
[OpenACC] Call 'cleanup' on lexical scopes before yield
When creating a 'yield', we have to make sure that the lexical scope we created gets cleaned up. This isn't really testable until a followup patch, but I got this wrong in quite a few places.
1 parent 85265a9 commit b936f2c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ void OpenACCRecipeBuilderBase::createRecipeDestroySection(
398398
emitDestroy(block->getArgument(1), elementTy);
399399
}
400400

401+
ls.forceCleanup();
401402
mlir::acc::YieldOp::create(builder, locEnd);
402403
}
403404
void OpenACCRecipeBuilderBase::makeBoundsInit(
@@ -480,6 +481,7 @@ void OpenACCRecipeBuilderBase::createInitRecipe(
480481
/*isInitSection=*/true);
481482
}
482483

484+
ls.forceCleanup();
483485
mlir::acc::YieldOp::create(builder, locEnd);
484486
}
485487

@@ -518,6 +520,7 @@ void OpenACCRecipeBuilderBase::createFirstprivateRecipeCopy(
518520
cgf.emitAutoVarInit(tempDeclEmission);
519521

520522
builder.setInsertionPointToEnd(&copyRegion.back());
523+
ls.forceCleanup();
521524
mlir::acc::YieldOp::create(builder, locEnd);
522525
}
523526

@@ -662,6 +665,7 @@ void OpenACCRecipeBuilderBase::createReductionRecipeCombiner(
662665
}
663666

664667
builder.setInsertionPointToEnd(&recipe.getCombinerRegion().back());
668+
ls.forceCleanup();
665669
mlir::acc::YieldOp::create(builder, locEnd, block->getArgument(0));
666670
}
667671

0 commit comments

Comments
 (0)