1 // Test that the HLFIR pipeline does not call MLIR canonicalizer with block
2 // merging enabled (moving fir.shape to block argument would cause failures
3 // when translating the FIR to LLVM).
4 // RUN: %flang_fc1 %s -flang-experimental-hlfir -emit-llvm -O2 -o - | FileCheck %s
6 func.func @no_shape_merge(%cdt: i1, %from: !fir.ref<!fir.array<?xf64>>, %to : !fir.ref<f64>) {
7 %c10 = arith.constant 10 : index
8 %c20 = arith.constant 20 : index
9 %c5 = arith.constant 5 : index
10 %shape1 = fir.shape %c10 : (index) -> !fir.shape<1>
11 %shape2 = fir.shape %c20 : (index) -> !fir.shape<1>
12 cf.cond_br %cdt, ^bb1, ^bb2
14 %coor1 = fir.array_coor %from(%shape1) %c5 : (!fir.ref<!fir.array<?xf64>>, !fir.shape<1>, index) -> !fir.ref<f64>
15 %load1 = fir.load %coor1 : !fir.ref<f64>
16 fir.store %load1 to %to : !fir.ref<f64>
19 %coor2 = fir.array_coor %from(%shape2) %c5 : (!fir.ref<!fir.array<?xf64>>, !fir.shape<1>, index) -> !fir.ref<f64>
20 %load2 = fir.load %coor2 : !fir.ref<f64>
21 fir.store %load2 to %to : !fir.ref<f64>
23 ^bb3: // pred: ^bb1, ^bb2
27 // Note: block merging happens in the output below, but after FIR codegen.
29 // CHECK-LABEL: define void @no_shape_merge(
30 // CHECK: %[[GEP:.*]] = getelementptr i8, ptr %{{.*}}
31 // CHECK: %[[LOAD:.*]] = load double, ptr %[[GEP]]
32 // CHECK: store double %[[LOAD]], ptr %{{.*}}