[flang-commits] [flang] [Flang] Add opt-in affine loop optimization pipeline (PR #191854)
via flang-commits
flang-commits at lists.llvm.org
Mon Apr 27 01:07:31 PDT 2026
shuyadav-dev wrote:
Hi @Jason-Van-Beusekom,
The crash on minimal.f90 is a pre-existing issue in the upstream AffinePromotion pass rather than something this patch introduces.
The pass has two parts — loop promotion and if/else promotion. Our work here is focused on the loop side (`fir.do_loop` -> `affine.for`). While working on it, we noticed a few latent issues in the `fir.if` promotion path (including the `error in fetching if analysis` you hit on `minimal.f90`), so to keep this PR scoped and the loop-side change clean, the latest commit explicitly blocks promotion of standalone `fir.if` *and* loops that contain a `fir.if`. That avoids the crash without pulling the if-side fixes into this patch.
We've also done the work to fix and extend the if-promotion path so `fir.if` -> `affine.if` is fully re-enabled. We'd ideally like to send that as a separate upstream patch, but it builds on the common infrastructure introduced here, so a standalone PR against `main` would end up duplicating most of this PR's diff. To make the follow-up change reviewable in isolation, I've put it up as a preview PR on my fork, based on this branch:
https://github.com/shuyadav-dev/llvm-project/pull/1 — [Flang] Promote fir.if to affine.if in AffinePromotion
That has the complete loop + fir.if promotion story and is the right place to look at the additional diff on its own.
If you and the other reviewers would prefer, I'm happy to **fold it into this PR as one additional commit** so both part land together. Otherwise, I'll send it as a follow-up PR against `main` once this one merges. Either way works for me.
https://github.com/llvm/llvm-project/pull/191854
More information about the flang-commits
mailing list