diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.h b/flang/lib/Optimizer/CodeGen/TypeConverter.h --- a/flang/lib/Optimizer/CodeGen/TypeConverter.h +++ b/flang/lib/Optimizer/CodeGen/TypeConverter.h @@ -318,7 +318,7 @@ if (auto seqTy = eleTy.dyn_cast()) { if (!seqTy.hasConstantShape() || characterWithDynamicLen(seqTy.getEleTy())) { - if (seqTy.hasConstantInterior()) + if (seqTy.getConstantRows() > 0) return convertType(seqTy); eleTy = seqTy.getEleTy(); } diff --git a/flang/test/Fir/alloc.fir b/flang/test/Fir/alloc.fir --- a/flang/test/Fir/alloc.fir +++ b/flang/test/Fir/alloc.fir @@ -279,7 +279,7 @@ // CHECK-SAME: i64 %[[a:.*]], i64 %[[b:.*]]) // CHECK: %[[prod1:.*]] = mul i64 60, %[[a]] // CHECK: %[[prod2:.*]] = mul i64 %[[prod1]], %[[b]] -// CHECK: alloca i32, i64 %[[prod2]] +// CHECK: alloca [4 x i32], i64 %[[prod2]] func.func @alloca_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.ref> { %a = fir.alloca !fir.array<4x?x3x?x5xi32>, %0, %1 return %a : !fir.ref> @@ -288,7 +288,7 @@ // CHECK-LABEL: define ptr @alloca_array_with_holes_char( // CHECK-SAME: i64 %[[e:.*]]) // CHECK: %[[mul:.*]] = mul i64 12, %[[e]] -// CHECK: alloca [10 x i16], i64 %[[mul]] +// CHECK: alloca [3 x [10 x i16]], i64 %[[mul]] func.func @alloca_array_with_holes_char(%e: index) -> !fir.ref>> { %1 = fir.alloca !fir.array<3x?x4x!fir.char<2,10>>, %e return %1 : !fir.ref>> @@ -306,7 +306,7 @@ // CHECK-LABEL: define ptr @allocmem_array_with_holes_nonchar( // CHECK-SAME: i64 %[[e1:.*]], i64 %[[e2:.*]]) -// CHECK: %[[a:.*]] = mul i64 240, %[[e1]] +// CHECK: %[[a:.*]] = mul i64 mul (i64 ptrtoint{{.*}} 60), %[[e1]] // CHECK: %[[b:.*]] = mul i64 %3, %[[e2]] // CHECK: call ptr @malloc(i64 %[[b]]) func.func @allocmem_array_with_holes_nonchar(%0 : index, %1 : index) -> !fir.heap> { @@ -316,7 +316,7 @@ // CHECK-LABEL: define ptr @allocmem_array_with_holes_char( // CHECK-SAME: i64 %[[e:.*]]) -// CHECK: %[[mul:.*]] = mul i64 mul (i64 ptrtoint (ptr getelementptr ([10 x i16], ptr null, i64 1) to i64), i64 12), %[[e]] +// CHECK: %[[mul:.*]] = mul i64 mul (i64 ptrtoint (ptr getelementptr ([3 x [10 x i16]], ptr null, i64 1) to i64), i64 12), %[[e]] // CHECK: call ptr @malloc(i64 %[[mul]]) func.func @allocmem_array_with_holes_char(%e: index) -> !fir.heap>> { %1 = fir.allocmem !fir.array<3x?x4x!fir.char<2,10>>, %e diff --git a/flang/test/Fir/convert-to-llvm.fir b/flang/test/Fir/convert-to-llvm.fir --- a/flang/test/Fir/convert-to-llvm.fir +++ b/flang/test/Fir/convert-to-llvm.fir @@ -1164,14 +1164,14 @@ } // CHECK-LABEL: llvm.func @alloca_array_with_holes -// CHECK-SAME: ([[A:%.*]]: i64, [[B:%.*]]: i64) -> !llvm.ptr +// CHECK-SAME: ([[A:%.*]]: i64, [[B:%.*]]: i64) -> !llvm.ptr> // CHECK-DAG: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64 // CHECK-DAG: [[FIXED:%.*]] = llvm.mlir.constant(60 : i64) : i64 // CHECK: [[PROD1:%.*]] = llvm.mul [[ONE]], [[FIXED]] : i64 // CHECK: [[PROD2:%.*]] = llvm.mul [[PROD1]], [[A]] : i64 // CHECK: [[PROD3:%.*]] = llvm.mul [[PROD2]], [[B]] : i64 -// CHECK: [[RES:%.*]] = llvm.alloca [[PROD3]] x i32 {in_type = !fir.array<4x?x3x?x5xi32> -// CHECK: llvm.return [[RES]] : !llvm.ptr +// CHECK: [[RES:%.*]] = llvm.alloca [[PROD3]] x !llvm.array<4 x i32> {in_type = !fir.array<4x?x3x?x5xi32> +// CHECK: llvm.return [[RES]] : !llvm.ptr> // ----- diff --git a/flang/test/Fir/types-to-llvm.fir b/flang/test/Fir/types-to-llvm.fir --- a/flang/test/Fir/types-to-llvm.fir +++ b/flang/test/Fir/types-to-llvm.fir @@ -49,7 +49,7 @@ // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>> func.func private @foo3(%arg0: !fir.ref>) // CHECK-LABEL: foo3 -// CHECK-SAME: !llvm.ptr +// CHECK-SAME: !llvm.ptr> func.func private @foo4(%arg0: !fir.ref>) // CHECK-LABEL: foo4 // CHECK-SAME: !llvm.ptr>>