[flang-commits] [flang] [llvm] [mlir] [Flang]Fix for changed code at the end of AllocaIP. (PR #92430)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Fri May 17 05:28:11 PDT 2024
Meinersbur wrote:
Ideally, the only thing added to the alloca block are allocas. Apparently in this case something is splitting the alloca block before the AllocaIP, do you know what exactly?
Resetting the insertion point to the beginning of the alloca block causes the inserted instructions to be reverser order. I don't think that's a big deal (unless the alloca size needs a value that has previously computed), but I would consider making a dedicated alloca block that is never split to be the cleaner solution. I created `splitBB` for this purpose. There is this code in `createTeams`:
```
if (&OuterAllocaBB == Builder.GetInsertBlock()) {
BasicBlock *BodyBB = splitBB(Builder, /*CreateBranch=*/true, "teams.entry");
Builder.SetInsertPoint(BodyBB, BodyBB->begin());
}
```
I'd prefer to not make the split conditional as it is here, it adds another possibly unnecessary BB but is more robust.
What do you think?
https://github.com/llvm/llvm-project/pull/92430
More information about the flang-commits
mailing list