================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits