[Mlir-commits] [mlir] [mlir][llvm] Improve alloca handling during inlining (PR #75961)

Johannes de Fine Licht llvmlistbot at llvm.org
Wed Dec 20 06:33:12 PST 2023


================
@@ -50,11 +50,31 @@ static bool hasLifetimeMarkers(LLVM::AllocaOp allocaOp) {
 static void
 handleInlinedAllocas(Operation *call,
                      iterator_range<Region::iterator> inlinedBlocks) {
+  // The traversal's goal is to locate the entry block of the closest call site
+  // ancestor that either has the 'isolated from above' or 'automatic allocation
+  // scope' trait. In pure LLVM dialect programs, this typically refers to the
+  // LLVM function containing the call site. However, in mixed-dialect programs,
+  // other operations may carry one of these traits. In such scenarios, the
+  // traversal stops at the closest ancestor with either trait, ensuring
+  // visibility post relocation and respecting allocation scopes.
----------------
definelicht wrote:

```suggestion
  // Locate the entry block of the closest callsite ancestor that has either the
  // IsolatedFromAbove or AutomaticAllocationScope trait. In pure LLVM dialect
  // programs, this is the LLVMFuncOp containing the call site. However, in
  // mixed-dialect programs, the callsite might be nested in another operation
  // that carries one of these traits. In such scenarios, this traversal stops at
  // the closest ancestor with either trait, ensuring visibility post relocation
  // and respecting allocation scopes.
```

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


More information about the Mlir-commits mailing list