[flang-commits] [flang] [flang][Lower] Emit exiting branches from within constructs (PR #92455)
via flang-commits
flang-commits at lists.llvm.org
Fri May 17 09:05:36 PDT 2024
vdonaldson wrote:
@kparzysz Thanks for working on this issue.
1. Do you have a test that illustrates the problem? The [91526](https://github.com/llvm/llvm-project/issues/91526) test case looks ok after your prior PR.
3. I'm seeing some failures with this change, such as for the test case below.
4. Are you aware of the `isIntermediateConstructStmt` Evaluation utility? That might make the extra `collectFinalEvaluations` traversal unnecessary. That would also provide a way to treat the last block of a sequence different than intermediate blocks, if that contributes to the problem below.
5. You are deleting not only the intermediate unstructured branch code, but also the degenerate construct block code. Accounting for degenerate code blocks is one complication with this functionality, although I don't immediately see a problem with that in this PR. Transitions between, and various nesting instances of structured and unstructured code sequences are another complication.
6. New line 3040 looks like it may be dead code.
Test - Expected output `1111`, not `1101`.
```
subroutine s(j, k)
goto (11, 22, 33) j-3 ! computed goto - an expression outside [1,3] is a nop
if (j == 2) goto 22
if (j == 1) goto 11
k = k + 1
11 k = k + 10
22 k = k + 100
33 k = k + 1000
end
program p
integer :: n = 0
call s(0, n)
print*, n
end
```
https://github.com/llvm/llvm-project/pull/92455
More information about the flang-commits
mailing list