[flang-commits] [flang] [flang] Fixing code reordering in alloca hoist pass. (PR #95610)

Vijay Kandiah via flang-commits flang-commits at lists.llvm.org
Fri Jun 14 14:58:15 PDT 2024


================
@@ -255,8 +255,10 @@ struct AllocaOpConversion : public fir::FIROpConversion<fir::AllocaOp> {
       mlir::Region *parentRegion = rewriter.getInsertionBlock()->getParent();
       mlir::Block *insertBlock =
           getBlockForAllocaInsert(parentOp, parentRegion);
-      size.getDefiningOp()->moveAfter(insertBlock, insertBlock->begin());
-      rewriter.setInsertionPointAfter(size.getDefiningOp());
+      if (rewriter.getInsertionBlock() != insertBlock) {
----------------
VijayKandiah wrote:

I agree. We would need to revisit to move allocas outside stacksave/restore regions + fix lit tests as necessary.

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


More information about the flang-commits mailing list