[flang-commits] [flang] [flang] Characterize allocation based on MemAlloc effect instead of pattern matching (PR #166806)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Fri Nov 7 16:04:05 PST 2025


================
@@ -191,6 +200,9 @@ func.func @_QPtest_copy_in_out_2(%arg0: !fir.box<!fir.array<*:f32>> {fir.bindc_n
   %3:2 = hlfir.copy_in %2#0 to %0 : (!fir.box<!fir.array<*:f32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>) -> (!fir.box<!fir.array<*:f32>>, i1)
   fir.call @_QPtakes_contiguous_intentin(%3#0) fastmath<contract> : (!fir.box<!fir.array<*:f32>>) -> ()
   hlfir.copy_out %0, %3#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<*:f32>>>>, i1) -> ()
+  // Keep %0 live to avoid DCE after inlining.
----------------
vzakhari wrote:

Same here: no need for a fake use.

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


More information about the flang-commits mailing list