[flang-commits] [flang] [flang] Fixing code reordering in alloca hoist pass. (PR #95610)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Fri Jun 14 14:54: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) {
----------------
vzakhari wrote:
This seems okay, but I think there might be cases where we will leave the allocas inside `stacksave/stackrestore` region (which the initial commit tried to avoid). I am okay with this change to resolve the LIT tests failures, but we may need to revisit this (and fix the tests, if needed).
https://github.com/llvm/llvm-project/pull/95610
More information about the flang-commits
mailing list