Skip to content

Conversation

@matthias-springer
Copy link
Member

AllocaOpConversion takes an ArrayRef<Operation *>, but the underlying SmallVector<Operation *> was dead by the time the pattern ran.

`AllocaOpConversion` takes an `ArrayRef<Operation *>`, but the
underlying `SmallVector<Operation *>` was dead by the time the pattern
ran.
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Mar 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 4, 2024

@llvm/pr-subscribers-flang-fir-hlfir

Author: Matthias Springer (matthias-springer)

Changes

AllocaOpConversion takes an ArrayRef&lt;Operation *&gt;, but the underlying SmallVector&lt;Operation *&gt; was dead by the time the pattern ran.


Full diff: https://github.com/llvm/llvm-project/pull/83768.diff

1 Files Affected:

  • (modified) flang/lib/Optimizer/Transforms/MemoryAllocation.cpp (+2-1)
diff --git a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
index f0e201402fa79c..166a6b10def293 100644
--- a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
+++ b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
@@ -200,7 +200,8 @@ class MemoryAllocationOpt
       return keepStackAllocation(alloca, &func.front(), options);
     });
 
-    patterns.insert<AllocaOpConversion>(context, analysis.getReturns(func));
+    llvm::SmallVector<mlir::Operation *> returnOps = analysis.getReturns(func);
+    patterns.insert<AllocaOpConversion>(context, returnOps);
     if (mlir::failed(
             mlir::applyPartialConversion(func, target, std::move(patterns)))) {
       mlir::emitError(func.getLoc(),

@matthias-springer matthias-springer merged commit 354deba into main Mar 4, 2024
@matthias-springer matthias-springer deleted the users/matthias-springer/fix_flang_1 branch March 4, 2024 06:54
matthias-springer added a commit that referenced this pull request Mar 4, 2024
…ionConfig` (#83754)

This commit adds a new `ConversionConfig` struct that allows users to
customize the dialect conversion. This configuration is similar to
`GreedyRewriteConfig` for the greedy pattern rewrite driver.

A few existing options are moved to this objects, simplifying the
dialect conversion API.

This is a re-upload of #82250. The Windows build breakage was fixed in #83768.

This reverts commit 60fbd60.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flang:fir-hlfir flang Flang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants