// RUN: fir-opt --simplify-intrinsics --mlir-print-debuginfo %s | FileCheck %s // Verify that the source location of a maxloc call is propagated into the // fir.do_loop generated inside the simplified function body, so that // downstream passes that require a valid FileLineColLoc do not crash. func.func @_QPtest(%arg0: !fir.ref> {fir.bindc_name = "a"}) { %c10 = arith.constant 10 : index %c4_i32 = arith.constant 4 : i32 %c5_i32 = arith.constant 5 : i32 %false = arith.constant false %0 = fir.alloca !fir.box>> %1 = fir.zero_bits !fir.heap> %c0 = arith.constant 0 : index %2 = fir.shape %c0 : (index) -> !fir.shape<1> %3 = fir.embox %1(%2) : (!fir.heap>, !fir.shape<1>) -> !fir.box>> fir.store %3 to %0 : !fir.ref>>> %4 = fir.shape %c10 : (index) -> !fir.shape<1> %5 = fir.embox %arg0(%4) : (!fir.ref>, !fir.shape<1>) -> !fir.box> %6 = fir.absent !fir.box %7 = fir.address_of(@_QQcl) : !fir.ref> %8 = fir.convert %0 : (!fir.ref>>>) -> !fir.ref> %9 = fir.convert %5 : (!fir.box>) -> !fir.box %10 = fir.convert %7 : (!fir.ref>) -> !fir.ref %11 = fir.convert %6 : (!fir.box) -> !fir.box fir.call @_FortranAMaxlocInteger4(%8, %9, %c4_i32, %10, %c5_i32, %11, %false) fastmath : (!fir.ref>, !fir.box, i32, !fir.ref, i32, !fir.box, i1) -> () loc("test.f90":5:3) return } // CHECK-LABEL: func.func private @_FortranAMaxlocInteger4x1_i32_contract_simplified( // CHECK: fir.do_loop // CHECK: loc([[LOC:#[^ ]*]]) // CHECK: [[LOC]] = loc("test.f90":5:3) func.func private @_FortranAMaxlocInteger4(!fir.ref>, !fir.box, i32, !fir.ref, i32, !fir.box, i1) -> () fir.global linkonce @_QQcl constant : !fir.char<1,8> { %0 = fir.string_lit "test.f90\00"(8) : !fir.char<1,8> fir.has_value %0 : !fir.char<1,8> }