[flang-commits] [flang] [Flang] Add FIR and LLVM lowering support for prefetch directive (PR #167272)

via flang-commits flang-commits at lists.llvm.org
Tue Dec 9 23:27:55 PST 2025


github-actions[bot] wrote:

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

* 3845 tests passed
* 202 tests skipped
* 2 tests failed

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

### Flang
<details>
<summary>Flang.Integration/prefetch.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/prefetch.f90 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/prefetch.f90 --check-prefixes=LLVM
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -emit-llvm -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/prefetch.f90
# 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/Integration/prefetch.f90 --check-prefixes=LLVM
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/prefetch.f90:25:10: error: LLVM: expected string not found in input
# |  ! LLVM: call void @llvm.prefetch.p0(ptr %[[VAR_A]], i32 0, i32 3, i32 1)
# |          ^
# | <stdin>:16:41: note: scanning from here
# |  %6 = alloca [256 x i32], i64 1, align 4
# |                                         ^
# | <stdin>:16:41: note: with "VAR_A" equal to "6"
# |  %6 = alloca [256 x i32], i64 1, align 4
# |                                         ^
# | <stdin>:23:2: note: possible intended match here
# |  call void @llvm.memcpy.p0.p0.i32(ptr %7, ptr %1, i32 48, i1 false)
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Integration/prefetch.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            11:  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8 
# |            12:  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8 
# |            13:  %3 = alloca i32, i64 1, align 4 
# |            14:  %4 = alloca i32, i64 1, align 4 
# |            15:  %5 = alloca i32, i64 1, align 4 
# |            16:  %6 = alloca [256 x i32], i64 1, align 4 
# | check:25'0                                             X error: no match found
# | check:25'1                                               with "VAR_A" equal to "6"
# |            17:  %7 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, i64 1, align 8 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            18:  store i32 23, ptr %3, align 4 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            19:  %8 = insertvalue { ptr, i64, i32, i8, i8, i8, i8 } { ptr undef, i64 4, i32 20240719, i8 0, i8 9, i8 0, i8 0 }, ptr %3, 0 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            20:  store { ptr, i64, i32, i8, i8, i8, i8 } %8, ptr %2, align 8 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            21:  %9 = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr undef, i64 4, i32 20240719, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]] [[3 x i64] [i64 1, i64 256, i64 4]] }, ptr %6, 0 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            22:  store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %9, ptr %1, align 8 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            23:  call void @llvm.memcpy.p0.p0.i32(ptr %7, ptr %1, i32 48, i1 false) 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:25'2      ?                                                                   possible intended match
# |            24:  call void @_FortranAAssign(ptr %7, ptr %2, ptr @_QQclXe043f549d931434183ada7b1d3e86910, i32 24) 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            25:  %10 = call i32 @_FortranASumInteger4(ptr %1, ptr @_QQclXe043f549d931434183ada7b1d3e86910, i32 27, i32 0, ptr null) 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            26:  store i32 %10, ptr %5, align 4 
# | check:25'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            27:  br label %11 
# | check:25'0     ~~~~~~~~~~~~~~
# |            28:  
# | check:25'0     ~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Flang.Lower/HLFIR/prefetch.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -emit-hlfir -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/HLFIR/prefetch.f90 | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/HLFIR/prefetch.f90 --check-prefixes=HLFIR
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/flang -fc1 -emit-hlfir -o - /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/HLFIR/prefetch.f90
# 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/HLFIR/prefetch.f90 --check-prefixes=HLFIR
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/HLFIR/prefetch.f90:21:11: error: HLFIR: expected string not found in input
# |  ! HLFIR: fir.prefetch %[[H_A]]#0 {read, data, localityHint = 3 : i32} : !fir.ref<!fir.array<256xi32>>
# |           ^
# | <stdin>:204:115: note: scanning from here
# |  %7:2 = hlfir.declare %6 {uniq_name = "_QFtest_prefetch_01Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
# |                                                                                                                   ^
# | <stdin>:204:115: note: with "H_A" equal to "3"
# |  %7:2 = hlfir.declare %6 {uniq_name = "_QFtest_prefetch_01Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
# |                                                                                                                   ^
# | <stdin>:206:4: note: possible intended match here
# |  hlfir.assign %c23_i32 to %3#0 : i32, !fir.ref<!fir.array<256xi32>>
# |    ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/HLFIR/prefetch.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           199:  %2 = fir.shape %c256 : (index) -> !fir.shape<1> 
# |           200:  %3:2 = hlfir.declare %1(%2) {uniq_name = "_QFtest_prefetch_01Ea"} : (!fir.ref<!fir.array<256xi32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<256xi32>>, !fir.ref<!fir.array<256xi32>>) 
# |           201:  %4 = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFtest_prefetch_01Ei"} 
# |           202:  %5:2 = hlfir.declare %4 {uniq_name = "_QFtest_prefetch_01Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# |           203:  %6 = fir.alloca i32 {bindc_name = "j", uniq_name = "_QFtest_prefetch_01Ej"} 
# |           204:  %7:2 = hlfir.declare %6 {uniq_name = "_QFtest_prefetch_01Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>) 
# | check:21'0                                                                                                                       X error: no match found
# | check:21'1                                                                                                                         with "H_A" equal to "3"
# |           205:  %c23_i32 = arith.constant 23 : i32 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           206:  hlfir.assign %c23_i32 to %3#0 : i32, !fir.ref<!fir.array<256xi32>> 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:21'2        ?                                                                 possible intended match
# |           207:  %8 = hlfir.sum %3#0 {fastmath = #arith.fastmath<contract>} : (!fir.ref<!fir.array<256xi32>>) -> i32 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           208:  hlfir.assign %8 to %5#0 : i32, !fir.ref<i32> 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           209:  %c1_i32 = arith.constant 1 : i32 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           210:  %9 = fir.convert %c1_i32 : (i32) -> index 
# | check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           211:  %c192_i32 = arith.constant 192 : i32 
# | check:21'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/167272


More information about the flang-commits mailing list