Skip to content

Changes so that temporaries do not use uniq_name. #1070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Builder/Character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ fir::factory::CharacterExprHelper::createCharacterTemp(mlir::Type type,
llvm::SmallVector<mlir::Value> lenParams;
if (typeLen == fir::CharacterType::unknownLen())
lenParams.push_back(len);
auto ref = builder.allocateLocal(loc, charTy, ".chrtmp", "",
auto ref = builder.allocateLocal(loc, charTy, "", ".chrtmp",
/*shape=*/llvm::None, lenParams);
return {ref, len};
}
Expand Down
6 changes: 3 additions & 3 deletions flang/lib/Optimizer/Builder/FIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mlir::Block *fir::FirOpBuilder::getAllocaBlock() {
}

/// Create a temporary variable on the stack. Anonymous temporaries have no
/// `name` value.
/// `name` value. Temporaries do not require a uniqued name.
mlir::Value
fir::FirOpBuilder::createTemporary(mlir::Location loc, mlir::Type type,
llvm::StringRef name, mlir::ValueRange shape,
Expand All @@ -208,8 +208,8 @@ fir::FirOpBuilder::createTemporary(mlir::Location loc, mlir::Type type,
}

assert(!type.isa<fir::ReferenceType>() && "cannot be a reference");
auto ae = create<fir::AllocaOp>(loc, type, name, dynamicLength, dynamicShape,
attrs);
auto ae = create<fir::AllocaOp>(loc, type, /*unique_name=*/llvm::StringRef{},
name, dynamicLength, dynamicShape, attrs);
if (hoistAlloc)
restoreInsertionPoint(insPt);
return ae;
Expand Down
6 changes: 4 additions & 2 deletions flang/lib/Optimizer/Dialect/FIROps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ void fir::AllocaOp::build(mlir::OpBuilder &builder,
llvm::StringRef uniq_name, llvm::StringRef bindc_name,
mlir::ValueRange typeparams, mlir::ValueRange shape,
llvm::ArrayRef<mlir::NamedAttribute> attributes) {
auto nameAttr = builder.getStringAttr(uniq_name);
auto bindcAttr = builder.getStringAttr(bindc_name);
auto nameAttr =
uniq_name.empty() ? mlir::StringAttr{} : builder.getStringAttr(uniq_name);
auto bindcAttr = bindc_name.empty() ? mlir::StringAttr{}
: builder.getStringAttr(bindc_name);
build(builder, result, wrapAllocaResultType(in_type), in_type, nameAttr,
bindcAttr, typeparams, shape);
result.addAttributes(attributes);
Expand Down
10 changes: 5 additions & 5 deletions flang/test/Lower/OpenMP/omp-seqloop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program wsloop

!FIRDialect: omp.parallel {
!$OMP PARALLEL
!FIRDialect: %[[PRIVATE_INDX:.*]] = fir.alloca i32 {{{.*}}uniq_name = "i"}
!FIRDialect: %[[PRIVATE_INDX:.*]] = fir.alloca i32 {{{.*}}bindc_name = "i"}
!FIRDialect: %[[FINAL_INDX:.*]] = fir.do_loop %[[INDX:.*]] = {{.*}} {
do i=1, 9
print*, i
Expand All @@ -28,7 +28,7 @@ subroutine sub1
integer :: i
integer :: arr(10)
!FIRDialect: omp.parallel {
!FIRDialect: {{.*}} = fir.alloca i32 {uniq_name = "i"}
!FIRDialect: {{.*}} = fir.alloca i32 {bindc_name = "i"}
!$OMP PARALLEL
do i=1, 10
arr(i) = i
Expand All @@ -44,7 +44,7 @@ subroutine sub2
integer :: i
integer :: arr(10)
!FIRDialect: omp.parallel {
!FIRDialect: {{.*}} = fir.alloca i32 {uniq_name = "i"}
!FIRDialect: {{.*}} = fir.alloca i32 {bindc_name = "i"}
!$OMP PARALLEL
!FIRDialect: omp.master {
!$OMP MASTER
Expand All @@ -67,15 +67,15 @@ subroutine sub3
integer :: i,j
integer :: arr(10)
!FIRDialect: omp.parallel {
!FIRDialect: {{.*}} = fir.alloca i32 {uniq_name = "i"}
!FIRDialect: {{.*}} = fir.alloca i32 {bindc_name = "i"}
!$OMP PARALLEL
do i=1, 10
arr(i) = i
end do
!FIRDialect: omp.master {
!$OMP MASTER
!FIRDialect: omp.parallel {
!FIRDialect: {{.*}} = fir.alloca i32 {uniq_name = "j"}
!FIRDialect: {{.*}} = fir.alloca i32 {bindc_name = "j"}
!$OMP PARALLEL
do j=1, 10
arr(j) = j
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/alternate-return.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function k(n1, n2)

! CHECK-LABEL: func @_QPs
subroutine s(n1, *, n2, *)
! CHECK: [[retval:%[0-9]+]] = fir.alloca index {{{.*}}uniq_name = "s"}
! CHECK: [[retval:%[0-9]+]] = fir.alloca index {{{.*}}bindc_name = "s"}
! CHECK-COUNT-3: fir.store {{.*}} to [[retval]] : !fir.ref<index>
if (n1 < n2) return 1
if (n1 > n2) return 2
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/array-constructor-2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ subroutine test4(a, b, n1, m1)
integer, external :: f1, f2, f3

! Dynamic array ctor with dynamic extent using implied do loops.
! CHECK-DAG: fir.alloca index {uniq_name = ".buff.pos"}
! CHECK-DAG: fir.alloca index {uniq_name = ".buff.size"}
! CHECK-DAG: fir.alloca index {bindc_name = ".buff.pos"}
! CHECK-DAG: fir.alloca index {bindc_name = ".buff.size"}
! CHECK-DAG: %[[c32:.*]] = constant 32 : index
! CHECK: fir.allocmem f32, %[[c32]]
! CHECK: fir.call @_QPf1(%{{.*}}) : (!fir.ref<i32>) -> i32
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/array-derived-assignments.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ subroutine test_deep_copy(t1, t2)
! CHECK-DAG: %[[VAL_15:.*]] = constant 10 : index
! CHECK-DAG: %[[VAL_16:.*]] = constant 0 : index
! CHECK-DAG: %[[VAL_17:.*]] = constant 1 : index
! CHECK: %[[VAL_18:.*]] = fir.alloca !fir.box<!fir.type<_QMarray_derived_assignTdeep_copy{{.*}}>> {uniq_name = ""}
! CHECK: %[[VAL_18:.*]] = fir.alloca !fir.box<!fir.type<_QMarray_derived_assignTdeep_copy{{.*}}>>
! CHECK: %[[VAL_19:.*]] = fir.shape %[[VAL_15]] : (index) -> !fir.shape<1>
! CHECK: br ^bb1(%[[VAL_16]], %[[VAL_15]] : index, index)
! CHECK: ^bb1(%[[VAL_20:.*]]: index, %[[VAL_21:.*]]: index):
Expand Down
10 changes: 5 additions & 5 deletions flang/test/Lower/array-elemental-calls-char-byval.f90
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ subroutine foo1(i, j, c)
! CHECK: ^bb2:
! CHECK: %[[VAL_11:.*]] = addi %[[VAL_8]], %[[VAL_3]] : index
! CHECK: %[[VAL_12:.*]] = fir.array_coor %[[VAL_6]](%[[VAL_7]]) %[[VAL_11]] typeparams %[[VAL_4]]#1 : (!fir.ref<!fir.array<10x!fir.char<1,?>>>, !fir.shape<1>, index, index) -> !fir.ref<!fir.char<1,?>>
! CHECK: %[[VAL_13:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_4]]#1 : index) {uniq_name = ".chrtmp"}
! CHECK: %[[VAL_13:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_4]]#1 : index) {bindc_name = ".chrtmp"}
! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_4]]#1 : (index) -> i64
! CHECK: %[[VAL_15:.*]] = fir.convert %[[VAL_13]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
! CHECK: %[[VAL_16:.*]] = fir.convert %[[VAL_12]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
Expand Down Expand Up @@ -64,7 +64,7 @@ subroutine foo2(i, j, c)
! CHECK-DAG: %[[VAL_27:.*]] = constant 1 : index
! CHECK: %[[VAL_28:.*]]:2 = fir.unboxchar %[[VAL_29]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
! CHECK: %[[VAL_30:.*]] = fir.shape %[[VAL_25]] : (index) -> !fir.shape<1>
! CHECK: %[[VAL_31:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_28]]#1 : index) {uniq_name = ".chrtmp"}
! CHECK: %[[VAL_31:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_28]]#1 : index) {bindc_name = ".chrtmp"}
! CHECK: %[[VAL_32:.*]] = fir.convert %[[VAL_28]]#1 : (index) -> i64
! CHECK: %[[VAL_33:.*]] = fir.convert %[[VAL_31]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
! CHECK: %[[VAL_34:.*]] = fir.convert %[[VAL_28]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
Expand Down Expand Up @@ -107,7 +107,7 @@ subroutine foo3(i, j)
! CHECK: %[[VAL_57:.*]] = fir.convert %[[VAL_56]] : (i32) -> i8
! CHECK: %[[VAL_58:.*]] = fir.undefined !fir.char<1>
! CHECK: %[[VAL_59:.*]] = fir.insert_value %[[VAL_58]], %[[VAL_57]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
! CHECK: %[[VAL_60:.*]] = fir.alloca !fir.char<1> {uniq_name = ".chrtmp"}
! CHECK: %[[VAL_60:.*]] = fir.alloca !fir.char<1> {bindc_name = ".chrtmp"}
! CHECK: fir.store %[[VAL_59]] to %[[VAL_60]] : !fir.ref<!fir.char<1>>
! CHECK: %[[VAL_61:.*]] = fir.convert %[[VAL_60]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<!fir.char<1,?>>
! CHECK: %[[VAL_62:.*]] = fir.emboxchar %[[VAL_61]], %[[VAL_48]] : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
Expand Down Expand Up @@ -139,7 +139,7 @@ subroutine foo4(i, j)
! CHECK: %[[VAL_78:.*]] = fir.insert_value %[[VAL_77]], %[[VAL_76]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
! CHECK: %[[VAL_79:.*]] = fir.alloca !fir.char<1>
! CHECK: fir.store %[[VAL_78]] to %[[VAL_79]] : !fir.ref<!fir.char<1>>
! CHECK: %[[VAL_80:.*]] = fir.alloca !fir.char<1> {uniq_name = ".chrtmp"}
! CHECK: %[[VAL_80:.*]] = fir.alloca !fir.char<1> {bindc_name = ".chrtmp"}
! CHECK: %[[VAL_81:.*]] = fir.convert %[[VAL_71]] : (index) -> i64
! CHECK: %[[VAL_82:.*]] = fir.convert %[[VAL_80]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<i8>
! CHECK: %[[VAL_83:.*]] = fir.convert %[[VAL_79]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<i8>
Expand Down Expand Up @@ -178,7 +178,7 @@ subroutine foo5(i, j)
! CHECK-DAG: %[[VAL_99:.*]] = constant 1 : index
! CHECK: %[[VAL_100:.*]] = fir.shape %[[VAL_97]] : (index) -> !fir.shape<1>
! CHECK: %[[VAL_101:.*]] = fir.address_of(@{{.*}}) : !fir.ref<!fir.char<1,5>>
! CHECK: %[[VAL_102:.*]] = fir.alloca !fir.char<1,5> {uniq_name = ".chrtmp"}
! CHECK: %[[VAL_102:.*]] = fir.alloca !fir.char<1,5> {bindc_name = ".chrtmp"}
! CHECK: %[[VAL_103:.*]] = fir.convert %[[VAL_95]] : (index) -> i64
! CHECK: %[[VAL_104:.*]] = fir.convert %[[VAL_102]] : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<i8>
! CHECK: %[[VAL_105:.*]] = fir.convert %[[VAL_101]] : (!fir.ref<!fir.char<1,5>>) -> !fir.ref<i8>
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/array-elemental-calls-char.f90
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ subroutine foo3(i, j)
! CHECK-DAG: %[[VAL_69:.*]] = constant 10 : index
! CHECK-DAG: %[[VAL_70:.*]] = constant 0 : index
! CHECK-DAG: %[[VAL_71:.*]] = constant 1 : index
! CHECK-DAG: %[[VAL_72:.*]] = fir.alloca !fir.char<1> {uniq_name = ""}
! CHECK-DAG: %[[VAL_72:.*]] = fir.alloca !fir.char<1>
! CHECK: %[[VAL_73:.*]] = fir.shape %[[VAL_69]] : (index) -> !fir.shape<1>
! CHECK: br ^bb1(%[[VAL_70]], %[[VAL_69]] : index, index)
! CHECK: ^bb1(%[[VAL_74:.*]]: index, %[[VAL_75:.*]]: index):
Expand Down Expand Up @@ -232,7 +232,7 @@ subroutine foo6(c)
! CHECK: %[[VAL_55:.*]] = addi %[[VAL_52]], %[[VAL_47]] : index
! CHECK: %[[VAL_56:.*]] = fir.array_coor %[[VAL_50]](%[[VAL_51]]) %[[VAL_55]] typeparams %[[VAL_48]]#1 : (!fir.ref<!fir.array<10x!fir.char<1,?>>>, !fir.shape<1>, index, index) -> !fir.ref<!fir.char<1,?>>
! CHECK: %[[VAL_57:.*]] = fir.emboxchar %[[VAL_56]], %[[VAL_48]]#1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
! CHECK: %[[VAL_58:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_48]]#1 : index) {uniq_name = ".result"}
! CHECK: %[[VAL_58:.*]] = fir.alloca !fir.char<1,?>(%[[VAL_48]]#1 : index) {bindc_name = ".result"}
! CHECK: %[[VAL_59:.*]] = fir.call @_QMchar_elemPelem_return_char(%[[VAL_58]], %[[VAL_48]]#1, %[[VAL_57]]) : (!fir.ref<!fir.char<1,?>>, index, !fir.boxchar<1>) -> !fir.boxchar<1>
! CHECK: br ^bb3(%[[VAL_46]], %[[VAL_48]]#1 : index, index)
! CHECK: ^bb3(%[[VAL_60:.*]]: index, %[[VAL_61:.*]]: index):
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/array-elemental-calls.f90
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ subroutine test_elem_by_ref(i, j)
! CHECK-SAME: %[[arg1:.*]]: !fir.ref<!fir.array<100xi32>>
subroutine test_elem_by_valueref(i, j)
integer :: i(100), j(100)
! CHECK-DAG: %[[tmpA:.*]] = fir.alloca i32 {adapt.valuebyref, uniq_name = {{.*}}}
! CHECK-DAG: %[[tmpB:.*]] = fir.alloca f32 {adapt.valuebyref, uniq_name = {{.*}}}
! CHECK-DAG: %[[tmpA:.*]] = fir.alloca i32 {adapt.valuebyref}
! CHECK-DAG: %[[tmpB:.*]] = fir.alloca f32 {adapt.valuebyref}
! CHECK: %[[jload:.*]] = fir.array_load %[[arg1]]
! CHECK: %[[cst:.*]] = constant 4.200000e+01 : f32
! CHECK: fir.store %[[cst]] to %[[tmpB]] : !fir.ref<f32>
Expand Down
20 changes: 10 additions & 10 deletions flang/test/Lower/explicit-interface-results.f90
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module caller

! CHECK-LABEL: func @_QMcallerPcst_array()
subroutine cst_array()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30xf32> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30xf32> {{{.*}}bindc_name = ".result"}
! CHECK: %[[shape:.*]] = fir.shape %{{.*}}, {{.*}} : (index, index) -> !fir.shape<2>
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_array() : () -> !fir.array<20x30xf32>
! CHECK: fir.save_result %[[res]] to %[[alloc]](%[[shape]]) : !fir.array<20x30xf32>, !fir.ref<!fir.array<20x30xf32>>, !fir.shape<2>
Expand All @@ -95,7 +95,7 @@ subroutine cst_array()

! CHECK-LABEL: func @_QMcallerPcst_char_cst_array()
subroutine cst_char_cst_array()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30x!fir.char<1,10>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.array<20x30x!fir.char<1,10>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[shape:.*]] = fir.shape %{{.*}}, {{.*}} : (index, index) -> !fir.shape<2>
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_char_cst_array() : () -> !fir.array<20x30x!fir.char<1,10>>
! CHECK: fir.save_result %[[res]] to %[[alloc]](%[[shape]]) typeparams %{{.*}} : !fir.array<20x30x!fir.char<1,10>>, !fir.ref<!fir.array<20x30x!fir.char<1,10>>>, !fir.shape<2>, index
Expand All @@ -104,7 +104,7 @@ subroutine cst_char_cst_array()

! CHECK-LABEL: func @_QMcallerPalloc()
subroutine alloc()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_alloc() : () -> !fir.box<!fir.heap<!fir.array<?xf32>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.heap<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
print *, return_alloc()
Expand All @@ -118,7 +118,7 @@ subroutine alloc()

! CHECK-LABEL: func @_QMcallerPcst_char_alloc()
subroutine cst_char_alloc()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_char_alloc() : () -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,10>>>>>
print *, return_cst_char_alloc()
Expand All @@ -132,7 +132,7 @@ subroutine cst_char_alloc()

! CHECK-LABEL: func @_QMcallerPdef_char_alloc()
subroutine def_char_alloc()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_def_char_alloc() : () -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
print *, return_def_char_alloc()
Expand All @@ -146,7 +146,7 @@ subroutine def_char_alloc()

! CHECK-LABEL: func @_QMcallerPpointer_test()
subroutine pointer_test()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?xf32>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?xf32>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_pointer() : () -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.ptr<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
print *, return_pointer()
Expand All @@ -155,7 +155,7 @@ subroutine pointer_test()

! CHECK-LABEL: func @_QMcallerPcst_char_pointer()
subroutine cst_char_pointer()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_cst_char_pointer() : () -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,10>>>>>
print *, return_cst_char_pointer()
Expand All @@ -164,7 +164,7 @@ subroutine cst_char_pointer()

! CHECK-LABEL: func @_QMcallerPdef_char_pointer()
subroutine def_char_pointer()
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_def_char_pointer() : () -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>
print *, return_def_char_pointer()
Expand Down Expand Up @@ -256,7 +256,7 @@ subroutine dyn_char_dyn_array(l, m, n)
! CHECK-LABEL: @_QMcallerPdyn_char_alloc
subroutine dyn_char_alloc(l)
integer :: l
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_dyn_char_alloc({{.*}}) : (!fir.ref<i32>) -> !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?x!fir.char<1,?>>>>>
print *, return_dyn_char_alloc(l)
Expand All @@ -271,7 +271,7 @@ subroutine dyn_char_alloc(l)
! CHECK-LABEL: @_QMcallerPdyn_char_pointer
subroutine dyn_char_pointer(l)
integer :: l
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> {{{.*}}uniq_name = ".result"}
! CHECK: %[[alloc:.*]] = fir.alloca !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>> {{{.*}}bindc_name = ".result"}
! CHECK: %[[res:.*]] = fir.call @_QMcalleePreturn_dyn_char_pointer({{.*}}) : (!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>
! CHECK: fir.save_result %[[res]] to %[[alloc]] : !fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?x!fir.char<1,?>>>>>
print *, return_dyn_char_pointer(l)
Expand Down
6 changes: 3 additions & 3 deletions flang/test/Lower/forall-2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! CHECK-LABEL: func @_QPimplied_iters_allocatable(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?xf32>>) {
subroutine implied_iters_allocatable(a1)
! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {adapt.valuebyref, uniq_name = "i"}
! CHECK: %[[VAL_1:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"}
! CHECK: %[[VAL_2:.*]] = constant 20 : index
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.array<20x!fir.type<_QFimplied_iters_allocatableTt{oui:!fir.logical<4>,arr:!fir.box<!fir.heap<!fir.array<?xf32>>>}>> {bindc_name = "thing", uniq_name = "_QFimplied_iters_allocatableEthing"}
! CHECK: %[[VAL_4:.*]] = fir.shape %[[VAL_2]] : (index) -> !fir.shape<1>
Expand Down Expand Up @@ -92,7 +92,7 @@ end subroutine implied_iters_allocatable
! CHECK-SAME: %[[VAL_0:.*]]: !fir.box<!fir.array<?x!fir.type<_QFforall_pointer_assignTt{ptr:!fir.box<!fir.ptr<!fir.array<?xf32>>>}>>>, %[[VAL_1:.*]]: !fir.box<!fir.array<?x!fir.type<_QFforall_pointer_assignTu{targ:!fir.array<20xf32>}>>> {fir.target},
! CHECK-SAME: %[[VAL_2:.*]]: !fir.ref<i32>, %[[VAL_3:.*]]: !fir.ref<i32>) {
subroutine forall_pointer_assign(ap, at, ii, ij)
! CHECK: %[[VAL_4:.*]] = fir.alloca i32 {adapt.valuebyref, uniq_name = "i"}
! CHECK: %[[VAL_4:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"}
! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_2]] : !fir.ref<i32>
! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i32) -> index
! CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_3]] : !fir.ref<i32>
Expand Down Expand Up @@ -149,7 +149,7 @@ end subroutine forall_pointer_assign

! CHECK-LABEL: func @_QPslice_with_explicit_iters() {
subroutine slice_with_explicit_iters
! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {adapt.valuebyref, uniq_name = "i"}
! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"}
! CHECK: %[[VAL_1:.*]] = constant 10 : index
! CHECK: %[[VAL_2:.*]] = constant 10 : index
! CHECK: %[[VAL_3:.*]] = fir.alloca !fir.array<10x10xi32> {bindc_name = "a", uniq_name = "_QFslice_with_explicit_itersEa"}
Expand Down
Loading