[llvm-branch-commits] [clang] [llvm] [mlir] [OMPIRBuilder] Add support for explicit deallocation points (PR #154752)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 27 04:07:24 PDT 2025


================
@@ -1870,9 +1821,12 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createParallel(
     };
   }
 
-  OI->OuterAllocaBB = OuterAllocaBlock;
+  OI->OuterAllocBB = OuterAllocaBlock;
   OI->EntryBB = PRegEntryBB;
   OI->ExitBB = PRegExitBB;
+  OI->OuterDeallocBBs.reserve(OuterDeallocIPs.size());
+  for (InsertPointTy DeallocIP : OuterDeallocIPs)
+    OI->OuterDeallocBBs.push_back(DeallocIP.getBlock());
----------------
Meinersbur wrote:

> Since InsertPointTy is defined in IRBuilder, we'd either have to move it or copy it into the CodeExtractor or store both block and iterator separately for each of these points in the CodeExtractor.

Is it just to avoid `#include <llvm/IR/IRBuilder.h>` in CodeExtractor.h?


>  The reason I didn't do it was that we already discard the specific insert point information for the allocation point, and just pass the block.

If only the block is relevant, a reasonable API passes only the block. Since there is precedence/symmetry, consider adding an assertion that checks that the IP is pointing to `getFirstInsertionPt()` or at least add a warning about this.

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


More information about the llvm-branch-commits mailing list