[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:04 PST 2025


================
@@ -31,6 +31,9 @@ func.func private @_test_inline_copy_in(%arg0: !fir.box<!fir.array<?x?x?xf64>> {
   fir.call @_QFPsb(%18, %19#0) fastmath<contract> : (!fir.ref<!fir.array<?xf64>>, !fir.ref<i32>) -> ()
   hlfir.copy_out %0, %17#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>, i1) -> ()
   hlfir.end_associate %19#1, %19#2 : !fir.ref<i32>, i1
+  // Keep %0 live to avoid DCE after inlining when no copy_out is needed.
----------------
vzakhari wrote:

Sorry, I do not get what happens in this case - can you please explain?  I think we do not have to insert the fake use here.

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


More information about the flang-commits mailing list