1 // Test local alloca and store inside hlfir.region_assign do not trigger the
2 // creation of a temporary for the LHS.
4 // RUN: fir-opt -o - -lower-hlfir-ordered-assignments --debug-only=flang-ordered-assignment -flang-dbg-order-assignment-schedule-only %s 2>&1 | FileCheck %s
7 func.func @simple(%arg0: !fir.ref<!fir.array<100x10xf32>> , %arg1: !fir.ref<!fir.array<10xi64>> , %arg2: !fir.ref<!fir.array<10xf32>>, %i: i64, %f: f32) {
8 %c10 = arith.constant 10 : index
9 %c100 = arith.constant 100 : index
10 %0 = fir.shape %c100, %c10 : (index, index) -> !fir.shape<2>
11 %1:2 = hlfir.declare %arg0(%0) {uniq_name = "_QFsimpleEx"} : (!fir.ref<!fir.array<100x10xf32>>, !fir.shape<2>) -> (!fir.ref<!fir.array<100x10xf32>>, !fir.ref<!fir.array<100x10xf32>>)
12 %2 = fir.shape %c10 : (index) -> !fir.shape<1>
13 %3:2 = hlfir.declare %arg1(%2) {uniq_name = "y"} : (!fir.ref<!fir.array<10xi64>>, !fir.shape<1>) -> (!fir.ref<!fir.array<10xi64>>, !fir.ref<!fir.array<10xi64>>)
17 %local_temp = fir.alloca i64
18 fir.store %i to %local_temp : !fir.ref<i64>
19 %icopy = fir.load %local_temp : !fir.ref<i64>
20 hlfir.elemental_addr %2 : !fir.shape<1> {
22 %5 = hlfir.designate %3#0 (%arg3) : (!fir.ref<!fir.array<10xi64>>, index) -> !fir.ref<i64>
23 %6 = fir.load %5 : !fir.ref<i64>
24 %7 = hlfir.designate %1#0 (%icopy, %6) : (!fir.ref<!fir.array<100x10xf32>>, i64, i64) -> !fir.ref<f32>
25 hlfir.yield %7 : !fir.ref<f32>
31 // CHECK: run 1 evaluate: region_assign