[clang] [llvm] [mlir] [OMPIRBuilder] always leave PARALLEL via the same barrier (PR #164586)
Michael Kruse via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 30 05:15:33 PDT 2025
================
@@ -1800,8 +1779,18 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createParallel(
Instruction *PRegPreFiniTI = PRegPreFiniBB->getTerminator();
InsertPointTy PreFiniIP(PRegPreFiniBB, PRegPreFiniTI->getIterator());
- if (Error Err = FiniCB(PreFiniIP))
- return Err;
+ if (!FiniInfo.FiniBB) {
+ if (Error Err = FiniCB(PreFiniIP))
----------------
Meinersbur wrote:
Can we improve the situation a bit to make it more predictable? There seem to be two code locations where FiniCB is called and FiniBB is assigned, here or in `commonDirectiveExit`. I propose refactoring this out into a different function whose task it is to get the FiniBB: If it was already created, return it; otherwise emit one. Such as
```cpp
struct FinalizationInfo {
...
BasicBlock *getOrCreateFinializationBranchTarget() {
if (!FiniBB) {
FiniCB(FiniIP);
FiniBB = FinIP.getBlock();
}
return FiniBB;
}
};
```
https://github.com/llvm/llvm-project/pull/164586
More information about the cfe-commits
mailing list