[flang-commits] [flang] [flang][FIR] allow mem2reg over fir.declare (PR #181848)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Thu Feb 19 10:03:11 PST 2026
================
@@ -66,3 +66,120 @@ func.func @cycle(%arg0: i64, %arg1: i1, %arg2: i64) {
^bb2:
cf.br ^bb1
}
+
+// -----
+
+// CHECK-LABEL: func.func @test_simple_declare(%arg0: !fir.ref<i32> {fir.bindc_name = "i"}) {
+// CHECK: %[[C42:.*]] = arith.constant 42 : i32
+// CHECK: %[[SCOPE:.*]] = fir.dummy_scope : !fir.dscope
+// CHECK: %[[ARG_DECL:.*]] = fir.declare %arg0 dummy_scope %[[SCOPE]] arg 1 {uniq_name = "_QFfooEi"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32>
+// CHECK: fir.declare_value %[[C42]] {uniq_name = "_QFfooEj"} : i32
+// CHECK: fir.store %[[C42]] to %[[ARG_DECL]] : !fir.ref<i32>
----------------
vzakhari wrote:
Thank you, Jean! Yes, I also do not have any good ideas to guarantee proper ordering and not block optimizations.
https://github.com/llvm/llvm-project/pull/181848
More information about the flang-commits
mailing list