[flang-commits] [flang] [DRAFT][flang][PFT] canonicalise multi-stmt if/cycle into structured if/else (PR #196386)

via flang-commits flang-commits at lists.llvm.org
Sat May 9 19:09:27 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 4257 tests passed
* 205 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Flang
<details>
<summary>Flang.Lower/OpenACC/acc-unstructured.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
bbc -fopenacc -emit-hlfir /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90 -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90
# executed command: bbc -fopenacc -emit-hlfir /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90 -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90:255:10: error: CHECK: expected string not found in input
# | ! CHECK: acc.loop combined(parallel) private(%[[PRIVJ]], %[[PRIVI]] : !fir.ref<i32>, !fir.ref<i32>) {
# |          ^
# | <stdin>:950:126: note: scanning from here
# |  %12 = acc.private varPtr(%3#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "i"}
# |                                                                                                                              ^
# | <stdin>:950:126: note: with "PRIVJ" equal to "11"
# |  %12 = acc.private varPtr(%3#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "i"}
# |                                                                                                                              ^
# | <stdin>:950:126: note: with "PRIVI" equal to "12"
# |  %12 = acc.private varPtr(%3#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "i"}
# |                                                                                                                              ^
# | <stdin>:951:2: note: possible intended match here
# |  acc.loop combined(parallel) private(%11, %12 : !fir.ref<i32>, !fir.ref<i32>) control(%arg1 : i32, %arg2 : i32) = (%c1_i32, %c1_i32_1 : i32, i32) to (%c8_i32, %c8_i32_2 : i32, i32) step (%c1_i32_0, %c1_i32_3 : i32, i32) {
# |  ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90:311:10: error: CHECK: expected string not found in input
# | ! CHECK: acc.loop private(%{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>) {
# |          ^
# | <stdin>:1109:52: note: scanning from here
# |  func.func @_QPtest_unstructured_collapse_loop_only(%arg0: !fir.box<!fir.array<?x?xf64>> {fir.bindc_name = "a"}) {
# |                                                    ^
# | <stdin>:1128:2: note: possible intended match here
# |  acc.loop private(%8, %9 : !fir.ref<i32>, !fir.ref<i32>) control(%arg1 : i32, %arg2 : i32) = (%c1_i32, %c1_i32_1 : i32, i32) to (%c8_i32, %c8_i32_2 : i32, i32) step (%c1_i32_0, %c1_i32_3 : i32, i32) {
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/OpenACC/acc-unstructured.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              .
# |              .
# |              .
# |            945:  %c1_i32_0 = arith.constant 1 : i32 
# |            946:  %11 = acc.private varPtr(%5#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "j"} 
# |            947:  %c1_i32_1 = arith.constant 1 : i32 
# |            948:  %c8_i32_2 = arith.constant 8 : i32 
# |            949:  %c1_i32_3 = arith.constant 1 : i32 
# |            950:  %12 = acc.private varPtr(%3#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "i"} 
# | check:255'0                                                                                                                                  X error: no match found
# | check:255'1                                                                                                                                    with "PRIVJ" equal to "11"
# | check:255'2                                                                                                                                    with "PRIVI" equal to "12"
# |            951:  acc.loop combined(parallel) private(%11, %12 : !fir.ref<i32>, !fir.ref<i32>) control(%arg1 : i32, %arg2 : i32) = (%c1_i32, %c1_i32_1 : i32, i32) to (%c8_i32, %c8_i32_2 : i32, i32) step (%c1_i32_0, %c1_i32_3 : i32, i32) { 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:255'3      ?                                                                                                                                                                                                                             possible intended match
# |            952:  %13:2 = hlfir.declare %11 {uniq_name = "_QFtest_unstructured_collapse_cycleEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            953:  %14:2 = hlfir.declare %12 {uniq_name = "_QFtest_unstructured_collapse_cycleEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            954:  fir.store %arg1 to %13#0 : !fir.ref<i32> 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            955:  fir.store %arg2 to %14#0 : !fir.ref<i32> 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            956:  %15 = fir.load %14#0 : !fir.ref<i32> 
# | check:255'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |           1104:  } attributes {collapse = [3], collapseDeviceType = [#acc.device_type<none>], independent = [#acc.device_type<none>], unstructured} 
# |           1105:  acc.yield 
# |           1106:  } 
# |           1107:  return 
# |           1108:  } 
# |           1109:  func.func @_QPtest_unstructured_collapse_loop_only(%arg0: !fir.box<!fir.array<?x?xf64>> {fir.bindc_name = "a"}) { 
# | check:311'0                                                        X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |           1110:  %0 = fir.dummy_scope : !fir.dscope 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1111:  %1:2 = hlfir.declare %arg0 dummy_scope %0 arg 1 {uniq_name = "_QFtest_unstructured_collapse_loop_onlyEa"} : (!fir.box<!fir.array<?x?xf64>>, !fir.dscope) -> (!fir.box<!fir.array<?x?xf64>>, !fir.box<!fir.array<?x?xf64>>) 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1112:  %2 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_unstructured_collapse_loop_onlyEi"} 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1113:  %3:2 = hlfir.declare %2 {uniq_name = "_QFtest_unstructured_collapse_loop_onlyEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1114:  %4 = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFtest_unstructured_collapse_loop_onlyEj"} 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# |           1123:  %8 = acc.private varPtr(%5#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "j"} 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1124:  %c1_i32_1 = arith.constant 1 : i32 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1125:  %c8_i32_2 = arith.constant 8 : i32 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1126:  %c1_i32_3 = arith.constant 1 : i32 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1127:  %9 = acc.private varPtr(%3#0 : !fir.ref<i32>) recipe(@privatization_ref_i32) -> !fir.ref<i32> {implicit = true, name = "i"} 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1128:  acc.loop private(%8, %9 : !fir.ref<i32>, !fir.ref<i32>) control(%arg1 : i32, %arg2 : i32) = (%c1_i32, %c1_i32_1 : i32, i32) to (%c8_i32, %c8_i32_2 : i32, i32) step (%c1_i32_0, %c1_i32_3 : i32, i32) { 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:311'1      ?                                                                                                                                                                                                        possible intended match
# |           1129:  %10:2 = hlfir.declare %8 {uniq_name = "_QFtest_unstructured_collapse_loop_onlyEj"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1130:  %11:2 = hlfir.declare %9 {uniq_name = "_QFtest_unstructured_collapse_loop_onlyEi"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1131:  fir.store %arg1 to %10#0 : !fir.ref<i32> 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1132:  fir.store %arg2 to %11#0 : !fir.ref<i32> 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           1133:  %12 = fir.load %11#0 : !fir.ref<i32> 
# | check:311'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |              .
# |              .
# |              .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/196386


More information about the flang-commits mailing list