[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
Wed May 22 05:53:46 PDT 2024
Meinersbur wrote:
> @Meinersbur The case is not that we are using `alloca` in conditionals - but that we do something like `if thing.is_allocated() then allocate-and copy into private variable` - we do the `alloca`, unconditionally. But those `if allocated` means there's an alternative path, so there's new blocks being created. And this means the end marker used in the original block gets changed so any previously stored insertion point becomes invalid.
In any case, the block that the conditional is inserted into should not be the alloca block. If there are alloca instructions after the split point, those allocas will be pushed out of the entry block. I would consider anything that inserts control flow into the AllocaIP to be fragile. If we only ever want to insert instructions to the end of the (current) alloca block, we should just pass the `BasicBlock*` everywhere, not an `InsertionPoint`.
https://github.com/llvm/llvm-project/pull/92430
More information about the flang-commits
mailing list