[flang-commits] [flang] [Flang] Hoisting constant-sized allocas at flang codegen. (PR #95310)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Jun 13 11:59:37 PDT 2024


================
@@ -282,17 +282,17 @@ func.func @_QPomp_target_data() {
 
  // CHECK-LABEL:  llvm.func @_QPomp_target_data() {
  // CHECK:    %0 = llvm.mlir.constant(1024 : index) : i64
- // CHECK:    %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
- // CHECK:    %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a"} : (i64) -> !llvm.ptr
- // CHECK:    %3 = llvm.mlir.constant(1024 : index) : i64
- // CHECK:    %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64
- // CHECK:    %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.array<1024 x i32> {bindc_name = "b"} : (i64) -> !llvm.ptr
- // CHECK:    %6 = llvm.mlir.constant(1024 : index) : i64
+ // CHECK:    %[[VAL_6:.*]] = llvm.mlir.constant(1 : i64) : i64
+ // CHECK:    %[[VAL_7:.*]] = llvm.alloca %[[VAL_6]] x !llvm.array<1024 x i32> {bindc_name = "d"} : (i64) -> !llvm.ptr
  // CHECK:    %[[VAL_4:.*]] = llvm.mlir.constant(1 : i64) : i64
  // CHECK:    %[[VAL_5:.*]] = llvm.alloca %[[VAL_4]] x !llvm.array<1024 x i32> {bindc_name = "c"} : (i64) -> !llvm.ptr
+ // CHECK:    %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64
+ // CHECK:    %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.array<1024 x i32> {bindc_name = "b"} : (i64) -> !llvm.ptr
+ // CHECK:    %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
+ // CHECK:    %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a"} : (i64) -> !llvm.ptr
  // CHECK:    %9 = llvm.mlir.constant(1024 : index) : i64
----------------
vzakhari wrote:

Not your change, but I suggest regenerating these checks from scratch to get rid of the numbered SSA values in the checks. 

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


More information about the flang-commits mailing list