[qt/clang/llvm]: Summary of bulk changes made
KDE Git Services - Bulk Change <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git repository change summary for qt/clang/llvm
Pushed by mirror-service into branch 'upstream/users/ergawy/enclode_in_scf.execute_region'.
Changed from 119fbaeffa97c4763a77ea8165388b7541056aea to 1d99ead9459fe79e0f14240ab2837981d2efd459
Acknowledgement was received that this change introduces only existing code that has been pushed to another public open source repository.
This change contains the following new commits:
Git commit 416e459e36912d987d687765f919c1761cad3163 by ergawy on 16/07/2026 at 10:59..
[flang][PFT] record every target of an assigned GO TO
Assigned GO TO (`go to v [, (l1, l2, ...)]`) is the third multiway
branch in the language, alongside the computed GO TO and arithmetic IF
that were addressed in PR #210012. Its PFTBuilder handler previously
did:
[&](const parser::AssignedGotoStmt &) {
eval.isUnstructured = true;
markSuccessorAsNewBlock(eval);
},
i.e. it recorded no branch targets at all -- neither `controlSuccessor`
nor `extraControlSuccessors` was populated.
Handle the assigned GO TO the same way PR #210012 handles the computed
GO TO and arithmetic IF: iterate every possible target and call
`markBranchTarget(eval, label)` for each, so that `controlSuccessor`
receives the first and `extraControlSuccessors` receives the rest.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
https://invent.kde.org/qt/clang/llvm/-/commit/416e459e36912d987d687765f919c1761cad3163
Git commit 3bf6ec5d581affe3b25a7069b57b95774749e4e4 by ergawy on 16/07/2026 at 11:17..
[flang][PFT-to-MLIR] Wrap unstructured Fortran constructs in scf.execute_region
Extend the PFT-to-MLIR (HLFIR/FIR) lowering so unstructured DO and IF
constructs are emitted inside scf.execute_region, hiding their multi-block
CFG behind a single op. OpenACC and OpenMP lowerings that reject
multi-block content (e.g. the "unstructured do loop in combined acc
construct" TODO in OpenACC.cpp) now see a structured op instead.
Flag: -mmlir --wrap-unstructured-constructs-in-execute-region (default on).
An evaluation is wrappable iff all of the following hold:
* wrap flag on
* eval is parser::DoConstruct or parser::IfConstruct
* eval.isUnstructured
* branchesAreInternal(eval) -- every controlSuccessor in the subtree
targets a nested eval or the constructExit
* !hasIncomingBranch(eval) -- no outside eval branches into the body
(PFT's synthetic IfConstruct around `if(c) goto X` absorbs label
targets between the IF and X; the incoming-branch check excludes
such wrappers when an outer GOTO names one of those labels)
* does not contain a ReturnStmt -- its lowering creates the function's
final block in the current region, which would mis-parent func.return
* not an infinite DO and does not contain one (no LoopControl in any
nested DO): the wrap's yield is unreachable and the body has no
write-shaped side effects, so RegionDCE treats the wrap as trivially
dead and drops it. Excluding the whole enclosing construct keeps
such infinite loops visible in the parent CFG.
* not the body DO of an enclosing OpenACCLoopConstruct or
OpenACCCombinedConstruct -- nor one of the N collapsed iterator DOs
reached by walking down through `collapse(N)`. Such DOs are driven
directly into acc.loop by the OpenACC lowering, so wrapping them
would hide the iteration from the acc.loop op.
Diagnostics
-----------
Emit per-wrap and per-function diagnostics on stderr so the wrapping is
observable from a single compile invocation:
[wrap-unstructured] wrapped DO at <loc>
[wrap-unstructured] wrapped IF at <loc>
[wrap-unstructured] summary: N execute_region(s) wrapping unstructured
constructs at <loc>
The counter is reset per function and the summary is suppressed when no
wraps fire.
Co-authored-by: Claude Opus 4.7 <[email protected]>
https://invent.kde.org/qt/clang/llvm/-/commit/3bf6ec5d581affe3b25a7069b57b95774749e4e4
Git commit 734638f0c7222917809905c4d6212e0836390cd7 by ergawy on 16/07/2026 at 11:17..
[flang][PFT] check every branch target in wrappability analyses
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
https://invent.kde.org/qt/clang/llvm/-/commit/734638f0c7222917809905c4d6212e0836390cd7
Git commit 1d99ead9459fe79e0f14240ab2837981d2efd459 by ergawy on 16/07/2026 at 11:17..
[flang][PFT-to-MLIR] pull the scf.execute_region wrap inside the DO lowering
wrapUnstructuredConstruct was previously invoked at the top of
genFIR(DoConstruct), before any of the per-branch preheader/header/body
blocks had been settled. That layout worked but was fragile: the wrap
happened before createEmptyBlocks (called inside
wrapUnstructuredConstruct) had a chance to reallocate doStmtEval.block
into the scf.execute_region entry block, and the follow-on setup
recomputed beginBlock from a stale value.
Introduce a maybeWrapAndRecalc lambda that is called in each of the DO
variants (infinite / while / increment / concurrent) after
maybeStartBlock(preheaderBlock). It:
- conditionally creates the scf.execute_region wrap,
- notices whether createEmptyBlocks allocated a fresh preheader
inside the new region, and, if so, branches the scf entry to it
and uses it as beginBlock; otherwise it falls back to the scf
entry block itself,
- refreshes bodyBlock/exitBlock so the rest of the DO lowering
lands inside the wrap.
headerBlock is now computed per-branch after the wrap so that the
"step beginBlock through preheader/header/mask" walk starts from the
correct scf-internal block. No functional change when
--wrap-unstructured-constructs-in-execute-region is off (unstructured
DOs still lower to flat CFG).
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
https://invent.kde.org/qt/clang/llvm/-/commit/1d99ead9459fe79e0f14240ab2837981d2efd459