[llvm] [mlir] [Utils][mlir] Fix interaction between CodeExtractor and OpenMPIRBuilder (PR #145051)
Tom Eccles via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 25 02:46:06 PDT 2025
https://github.com/tblah approved this pull request.
LGTM this is the best fix we can do before LLVM-21.
I had a deeper look at this. The bug is in `OpenMPIRBuilder::createTarget`. This creates the outlined target function immediately instead of using storing an `OpenMPIRBuilder::OutlineInfo` like every other `OpenMPIRBuilder` method. Doing this invalidates the saved alloca insertion points in `OpenMPToLLVMIRTranslation.cpp`. I expect this probably results in other yet to be discovered unintended consequences too because this breaks assumptions in other operations.
Is there a reason that target has to be handled differently? If not, either target offload maintainers should fix this to conform with the existing design or we should have an RFC discussing dropping the delayed outlining (`OutlineInfo`) entirely so that outlining occurs in a consistent way.
(I'm aware that `OutlineInfo` probably doesn't have the right information for target outlining now, but that would be easy to add. My concern is that the outlining should all be done in the order defined by the `OutlineInfos` stack in `OpenMPIRBuilder`).
https://github.com/llvm/llvm-project/pull/145051
More information about the llvm-commits
mailing list