[flang-commits] [flang] [flang][cuda] Keep delayed descriptor allocs out of CFG loops (PR #232992)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Sat Oct 17 20:31:56 PDT 2026
================
@@ -108,6 +110,17 @@ findDelayTarget(fir::DeclareOp declareOp, mlir::Block *entryBlock,
return nullptr;
}
+ // A block on a CFG cycle (e.g. the header of a DO loop that lowered to
+ // branches because it contains a RETURN) executes once per trip, and the
+ // alloc would replace the descriptor each time. Climb the dominator tree to
+ // the nearest block that is not on a cycle. Reachability covers irreducible
+ // cycles too, and the entry block has no predecessors, so it always ends.
+ while (common->isReachable(common)) {
----------------
clementval wrote:
isReachable is a fresh graph walk on every climb step. It might be better to compute which blocks are in a cycle next to domInfo once per function and just query it.
https://github.com/llvm/llvm-project/pull/232992
More information about the flang-commits
mailing list