[llvm] [OMPIRBuilder] Prevent dangling InsertPt in IRBuilder. (PR #148887)

Abid Qadeer via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 09:09:11 PDT 2026


abidh wrote:

> Thanks for fixing this. Is it possible to set no insert point? Like a nullptr. The insert points added here aren't really meaningful to anything that tries to use them.

Sorry for the very late reply, this one fell off my radar for far longer than it should have. I have now used `ClearInsertionPoint()` instead of pointing to the parent of deleted instruction.  There are 2 other small changes:

The `emitTargetTaskProxyFunction` was obtaining the module through `Builder.GetInsertBlock()->getModule()`, so with a cleared insert point it crashed in omptarget-depend.mlir and omptarget-if-nowait.mlir. It now uses OMPBuilder.M, which removes the hidden dependency on whatever block the builder happened to be left pointing at.

I also dropped the if in `createTask`, since clearing unconditionally makes all three sites read the same

https://github.com/llvm/llvm-project/pull/148887


More information about the llvm-commits mailing list