Skip to content

Commit 2cb31fe

Browse files
authored
[flang] Centralize automatic deallocation code in lowering (#67003)
There are currently several places that automatically deallocate allocatble if they are allocated: - INTENT(OUT) allocatable are deallocated on entry in the callee - INTENT(OUT) allocatable are also deallocated on the caller side of BIND(C) function in case the implementation is in C. - Results of function returning allocatable are deallocated after usage. - OPENMP privatized allocatable are deallocated at the end of OPENMP region. Introduce genDeallocateIfAllocated that centralize all this code, except for the function return that use genFreememIfAllocated since finalization is done separately currently. `fir::factory::genFinalization` and `fir::factory::genInlinedDeallocation` are removed and replaced by genFreemem since their name were misleading: finalization was not called. There is a fallout in the tests because previous generated code did not check the allocated status when doing inline deallocation. This was OK since free(null) is guaranteed to be a no-op, but this makes compiler code more complex, is a bit surprising in the generated IR IMHO, and it relied on knowing when genDeallocateBox inserts runtime calls or uses inlined code.
1 parent f5f7e2a commit 2cb31fe

File tree

11 files changed

+170
-144
lines changed

11 files changed

+170
-144
lines changed

flang/include/flang/Lower/Allocatable.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ void genDeallocateBox(AbstractConverter &converter,
5757
const fir::MutableBoxValue &box, mlir::Location loc,
5858
mlir::Value declaredTypeDesc = {});
5959

60+
/// Deallocate an allocatable if it is allocated at the end of its lifetime.
61+
void genDeallocateIfAllocated(AbstractConverter &converter,
62+
const fir::MutableBoxValue &box,
63+
mlir::Location loc);
64+
6065
/// Create a MutableBoxValue for an allocatable or pointer entity.
6166
/// If the variables is a local variable that is not a dummy, it will be
6267
/// initialized to unallocated/diassociated status.

flang/include/flang/Optimizer/Builder/MutableBox.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,22 @@ void finalizeRealloc(fir::FirOpBuilder &builder, mlir::Location loc,
120120
bool takeLboundsIfRealloc,
121121
const MutableBoxReallocation &realloc);
122122

123-
/// Finalize a mutable box if it is allocated or associated. This includes both
124-
/// calling the finalizer, if any, and deallocating the storage.
125-
void genFinalization(fir::FirOpBuilder &builder, mlir::Location loc,
126-
const fir::MutableBoxValue &box);
123+
/// Deallocate a mutable box with fir.freemem if it is allocated or associated.
124+
/// This only deallocates the storage and does not call finalization, the
125+
/// mutable box is not nullified.
126+
void genFreememIfAllocated(fir::FirOpBuilder &builder, mlir::Location loc,
127+
const fir::MutableBoxValue &box);
127128

128129
void genInlinedAllocation(fir::FirOpBuilder &builder, mlir::Location loc,
129130
const fir::MutableBoxValue &box,
130131
mlir::ValueRange lbounds, mlir::ValueRange extents,
131132
mlir::ValueRange lenParams, llvm::StringRef allocName,
132133
bool mustBeHeap = false);
133134

134-
mlir::Value genInlinedDeallocate(fir::FirOpBuilder &builder, mlir::Location loc,
135-
const fir::MutableBoxValue &box);
135+
/// Deallocate an mutable box storage with fir.freemem without calling any
136+
/// final procedures. The mutable box is not nullified.
137+
mlir::Value genFreemem(fir::FirOpBuilder &builder, mlir::Location loc,
138+
const fir::MutableBoxValue &box);
136139

137140
/// When the MutableBoxValue was passed as a fir.ref<fir.box> to a call that may
138141
/// have modified it, update the MutableBoxValue according to the

flang/lib/Lower/Allocatable.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static mlir::Value genDeallocate(fir::FirOpBuilder &builder, mlir::Location loc,
746746
if (!box.isDerived() && !box.isPolymorphic() &&
747747
!box.isUnlimitedPolymorphic() && !errorManager.hasStatSpec() &&
748748
!useAllocateRuntime) {
749-
return fir::factory::genInlinedDeallocate(builder, loc, box);
749+
return fir::factory::genFreemem(builder, loc, box);
750750
}
751751
// Use runtime calls to deallocate descriptor cases. Sync MutableBoxValue
752752
// with its descriptor before and after calls if needed.
@@ -770,6 +770,26 @@ void Fortran::lower::genDeallocateBox(
770770
genDeallocate(builder, loc, box, errorManager, declaredTypeDesc);
771771
}
772772

773+
void Fortran::lower::genDeallocateIfAllocated(
774+
Fortran::lower::AbstractConverter &converter,
775+
const fir::MutableBoxValue &box, mlir::Location loc) {
776+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
777+
mlir::Value isAllocated =
778+
fir::factory::genIsAllocatedOrAssociatedTest(builder, loc, box);
779+
builder.genIfThen(loc, isAllocated)
780+
.genThen([&]() {
781+
if (mlir::Type eleType = box.getEleTy();
782+
eleType.isa<fir::RecordType>() && box.isPolymorphic()) {
783+
mlir::Value declaredTypeDesc = builder.create<fir::TypeDescOp>(
784+
loc, mlir::TypeAttr::get(eleType));
785+
genDeallocateBox(converter, box, loc, declaredTypeDesc);
786+
} else {
787+
genDeallocateBox(converter, box, loc);
788+
}
789+
})
790+
.end();
791+
}
792+
773793
static void preDeallocationAction(Fortran::lower::AbstractConverter &converter,
774794
fir::FirOpBuilder &builder,
775795
mlir::Value beginOpValue,
@@ -813,12 +833,13 @@ void Fortran::lower::genDeallocateStmt(
813833
genMutableBoxValue(converter, loc, allocateObject);
814834
mlir::Value declaredTypeDesc = {};
815835
if (box.isPolymorphic()) {
816-
assert(symbol.GetType());
817-
if (const Fortran::semantics::DerivedTypeSpec *derivedTypeSpec =
818-
symbol.GetType()->AsDerived()) {
819-
declaredTypeDesc =
820-
Fortran::lower::getTypeDescAddr(converter, loc, *derivedTypeSpec);
821-
}
836+
mlir::Type eleType = box.getEleTy();
837+
if (eleType.isa<fir::RecordType>())
838+
if (const Fortran::semantics::DerivedTypeSpec *derivedTypeSpec =
839+
symbol.GetType()->AsDerived()) {
840+
declaredTypeDesc =
841+
Fortran::lower::getTypeDescAddr(converter, loc, *derivedTypeSpec);
842+
}
822843
}
823844
mlir::Value beginOpValue =
824845
genDeallocate(builder, loc, box, errorManager, declaredTypeDesc);

flang/lib/Lower/Bridge.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -706,14 +706,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
706706
return;
707707
}
708708
// deallocate allocated in createHostAssociateVarClone value
709-
mlir::Value needs_dealloc =
710-
fir::factory::genIsAllocatedOrAssociatedTest(*builder, loc,
711-
new_box);
712-
builder->genIfThen(loc, needs_dealloc)
713-
.genThen([&]() {
714-
Fortran::lower::genDeallocateBox(*this, new_box, loc);
715-
})
716-
.end();
709+
Fortran::lower::genDeallocateIfAllocated(*this, new_box, loc);
717710
},
718711
[&](const auto &) -> void {
719712
// Do nothing

flang/lib/Lower/ConvertCall.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,13 @@ fir::ExtendedValue Fortran::lower::genCallOpAndResult(
461461
allocatedResult->match(
462462
[&](const fir::MutableBoxValue &box) {
463463
if (box.isAllocatable() && !cleanupWithDestroy) {
464-
// 9.7.3.2 point 4. Finalize allocatables.
464+
// 9.7.3.2 point 4. Deallocate allocatable results. Note that
465+
// finalization was done independently by calling
466+
// genDerivedTypeDestroy above and is not triggered by this inline
467+
// deallocation.
465468
fir::FirOpBuilder *bldr = &converter.getFirOpBuilder();
466469
stmtCtx.attachCleanup([bldr, loc, box]() {
467-
fir::factory::genFinalization(*bldr, loc, box);
470+
fir::factory::genFreememIfAllocated(*bldr, loc, box);
468471
});
469472
}
470473
},

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,26 +2646,14 @@ class ScalarExprLowering {
26462646
}
26472647
// Passing a POINTER to a POINTER, or an ALLOCATABLE to an ALLOCATABLE.
26482648
fir::MutableBoxValue mutableBox = genMutableBoxValue(*expr);
2649+
if (fir::isAllocatableType(argTy) && arg.isIntentOut() &&
2650+
Fortran::semantics::IsBindCProcedure(*procRef.proc().GetSymbol()))
2651+
Fortran::lower::genDeallocateIfAllocated(converter, mutableBox, loc);
26492652
mlir::Value irBox =
26502653
fir::factory::getMutableIRBox(builder, loc, mutableBox);
26512654
caller.placeInput(arg, irBox);
26522655
if (arg.mayBeModifiedByCall())
26532656
mutableModifiedByCall.emplace_back(std::move(mutableBox));
2654-
if (fir::isAllocatableType(argTy) && arg.isIntentOut() &&
2655-
Fortran::semantics::IsBindCProcedure(*procRef.proc().GetSymbol())) {
2656-
if (mutableBox.isDerived() || mutableBox.isPolymorphic() ||
2657-
mutableBox.isUnlimitedPolymorphic()) {
2658-
mlir::Value isAlloc = fir::factory::genIsAllocatedOrAssociatedTest(
2659-
builder, loc, mutableBox);
2660-
builder.genIfThen(loc, isAlloc)
2661-
.genThen([&]() {
2662-
Fortran::lower::genDeallocateBox(converter, mutableBox, loc);
2663-
})
2664-
.end();
2665-
} else {
2666-
Fortran::lower::genDeallocateBox(converter, mutableBox, loc);
2667-
}
2668-
}
26692657
continue;
26702658
}
26712659
if (arg.passBy == PassBy::BaseAddress || arg.passBy == PassBy::BoxChar ||

flang/lib/Lower/ConvertVariable.cpp

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -749,40 +749,17 @@ static void deallocateIntentOut(Fortran::lower::AbstractConverter &converter,
749749
}
750750
mlir::Location loc = converter.getCurrentLocation();
751751
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
752-
auto genDeallocateWithTypeDesc = [&]() {
753-
if (mutBox->isDerived() || mutBox->isPolymorphic() ||
754-
mutBox->isUnlimitedPolymorphic()) {
755-
mlir::Value isAlloc = fir::factory::genIsAllocatedOrAssociatedTest(
756-
builder, loc, *mutBox);
757-
builder.genIfThen(loc, isAlloc)
758-
.genThen([&]() {
759-
if (mutBox->isPolymorphic()) {
760-
mlir::Value declaredTypeDesc;
761-
assert(sym.GetType());
762-
if (const Fortran::semantics::DerivedTypeSpec
763-
*derivedTypeSpec = sym.GetType()->AsDerived()) {
764-
declaredTypeDesc = Fortran::lower::getTypeDescAddr(
765-
converter, loc, *derivedTypeSpec);
766-
}
767-
genDeallocateBox(converter, *mutBox, loc, declaredTypeDesc);
768-
} else {
769-
genDeallocateBox(converter, *mutBox, loc);
770-
}
771-
})
772-
.end();
773-
} else {
774-
genDeallocateBox(converter, *mutBox, loc);
775-
}
776-
};
777752

778753
if (Fortran::semantics::IsOptional(sym)) {
779754
auto isPresent = builder.create<fir::IsPresentOp>(
780755
loc, builder.getI1Type(), fir::getBase(extVal));
781756
builder.genIfThen(loc, isPresent)
782-
.genThen([&]() { genDeallocateWithTypeDesc(); })
757+
.genThen([&]() {
758+
Fortran::lower::genDeallocateIfAllocated(converter, *mutBox, loc);
759+
})
783760
.end();
784761
} else {
785-
genDeallocateWithTypeDesc();
762+
Fortran::lower::genDeallocateIfAllocated(converter, *mutBox, loc);
786763
}
787764
}
788765
}

flang/lib/Optimizer/Builder/MutableBox.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -454,29 +454,27 @@ mlir::Value fir::factory::genIsNotAllocatedOrAssociatedTest(
454454
return builder.genIsNullAddr(loc, addr);
455455
}
456456

457-
/// Generate finalizer call and inlined free. This does not check that the
457+
/// Call freemem. This does not check that the
458458
/// address was allocated.
459-
static void genFinalizeAndFree(fir::FirOpBuilder &builder, mlir::Location loc,
460-
mlir::Value addr) {
461-
// TODO: call finalizer if any.
462-
459+
static void genFreemem(fir::FirOpBuilder &builder, mlir::Location loc,
460+
mlir::Value addr) {
463461
// A heap (ALLOCATABLE) object may have been converted to a ptr (POINTER),
464462
// so make sure the heap type is restored before deallocation.
465463
auto cast = builder.createConvert(
466464
loc, fir::HeapType::get(fir::dyn_cast_ptrEleTy(addr.getType())), addr);
467465
builder.create<fir::FreeMemOp>(loc, cast);
468466
}
469467

470-
void fir::factory::genFinalization(fir::FirOpBuilder &builder,
471-
mlir::Location loc,
472-
const fir::MutableBoxValue &box) {
468+
void fir::factory::genFreememIfAllocated(fir::FirOpBuilder &builder,
469+
mlir::Location loc,
470+
const fir::MutableBoxValue &box) {
473471
auto addr = MutablePropertyReader(builder, loc, box).readBaseAddress();
474472
auto isAllocated = builder.genIsNotNullAddr(loc, addr);
475473
auto ifOp = builder.create<fir::IfOp>(loc, isAllocated,
476474
/*withElseRegion=*/false);
477475
auto insPt = builder.saveInsertionPoint();
478476
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
479-
genFinalizeAndFree(builder, loc, addr);
477+
::genFreemem(builder, loc, addr);
480478
builder.restoreInsertionPoint(insPt);
481479
}
482480

@@ -753,12 +751,11 @@ void fir::factory::genInlinedAllocation(
753751
fir::MustBeHeapAttr::get(builder.getContext(), mustBeHeap));
754752
}
755753

756-
mlir::Value
757-
fir::factory::genInlinedDeallocate(fir::FirOpBuilder &builder,
758-
mlir::Location loc,
759-
const fir::MutableBoxValue &box) {
754+
mlir::Value fir::factory::genFreemem(fir::FirOpBuilder &builder,
755+
mlir::Location loc,
756+
const fir::MutableBoxValue &box) {
760757
auto addr = MutablePropertyReader(builder, loc, box).readBaseAddress();
761-
genFinalizeAndFree(builder, loc, addr);
758+
::genFreemem(builder, loc, addr);
762759
MutablePropertyWriter{builder, loc, box}.setUnallocatedStatus();
763760
return addr;
764761
}
@@ -909,8 +906,7 @@ void fir::factory::finalizeRealloc(fir::FirOpBuilder &builder,
909906
auto heap = fir::getBase(realloc.newValue);
910907
auto extents = fir::factory::getExtents(loc, builder, realloc.newValue);
911908
builder.genIfThen(loc, realloc.oldAddressWasAllocated)
912-
.genThen(
913-
[&]() { genFinalizeAndFree(builder, loc, realloc.oldAddress); })
909+
.genThen([&]() { ::genFreemem(builder, loc, realloc.oldAddress); })
914910
.end();
915911
MutablePropertyWriter{builder, loc, box}.updateMutableBox(
916912
heap, lbs, extents, lengths);

flang/test/Lower/Intrinsics/system_clock.f90

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ subroutine ss(count)
5353
! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref<i64>
5454
! CHECK: }
5555
! CHECK: %[[V_12:[0-9]+]] = fir.convert %[[V_9]] : (!fir.ptr<i64>) -> i64
56-
! CHECK: %[[V_13:[0-9]+]] = arith.cmpi ne, %[[V_12]], %c0{{.*}}_i64 : i64
56+
! CHECK: %[[V_13:[0-9]+]] = arith.cmpi ne, %[[V_12]], %c0{{.*}} : i64
5757
! CHECK: fir.if %[[V_13]] {
58-
! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
58+
! CHECK: %[[V_29:[0-9]+]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
5959
! CHECK: fir.store %[[V_29]] to %[[V_9]] : !fir.ptr<i64>
6060
! CHECK: }
6161
! CHECK: %[[V_14:[0-9]+]] = fir.convert %[[V_10]] : (!fir.heap<i64>) -> i64
62-
! CHECK: %[[V_15:[0-9]+]] = arith.cmpi ne, %[[V_14]], %c0{{.*}}_i64_0 : i64
62+
! CHECK: %[[V_15:[0-9]+]] = arith.cmpi ne, %[[V_14]], %c0{{.*}} : i64
6363
! CHECK: fir.if %[[V_15]] {
6464
! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
6565
! CHECK: fir.store %[[V_29]] to %[[V_10]] : !fir.heap<i64>
@@ -77,24 +77,24 @@ subroutine ss(count)
7777
! CHECK: %[[V_39:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_31]], %[[V_38]]) {{.*}}: (!fir.ref<i8>, i64) -> i1
7878
! CHECK: %[[V_40:[0-9]+]] = fir.call @_FortranAioEndIoStatement(%[[V_31]]) {{.*}}: (!fir.ref<i8>) -> i32
7979
! CHECK: } else {
80-
! CHECK: %[[V_29]] = fir.load %[[V_4]] : !fir.ref<!fir.ptr<i64>>
80+
! CHECK: %[[V_29:[0-9]+]] = fir.load %[[V_4]] : !fir.ref<!fir.ptr<i64>>
8181
! CHECK: %[[V_30:[0-9]+]] = fir.load %[[V_1]] : !fir.ref<!fir.heap<i64>>
82-
! CHECK: %[[V_31]] = fir.convert %[[V_29]] : (!fir.ptr<i64>) -> i64
83-
! CHECK: %[[V_32]] = arith.cmpi ne, %[[V_31]], %c0{{.*}}_i64_3 : i64
82+
! CHECK: %[[V_31:[0-9]+]] = fir.convert %[[V_29]] : (!fir.ptr<i64>) -> i64
83+
! CHECK: %[[V_32:[0-9]+]] = arith.cmpi ne, %[[V_31]], %c0{{.*}} : i64
8484
! CHECK: fir.if %[[V_32]] {
8585
! CHECK: %[[V_45:[0-9]+]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
8686
! CHECK: fir.store %[[V_45]] to %[[V_29]] : !fir.ptr<i64>
8787
! CHECK: }
88-
! CHECK: %[[V_33]] = fir.convert %[[V_30]] : (!fir.heap<i64>) -> i64
89-
! CHECK: %[[V_34]] = arith.cmpi ne, %[[V_33]], %c0{{.*}}_i64_4 : i64
88+
! CHECK: %[[V_33:[0-9]+]] = fir.convert %[[V_30]] : (!fir.heap<i64>) -> i64
89+
! CHECK: %[[V_34:[0-9]+]] = arith.cmpi ne, %[[V_33]], %c0{{.*}} : i64
9090
! CHECK: fir.if %[[V_34]] {
9191
! CHECK: %[[V_45]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
9292
! CHECK: fir.store %[[V_45]] to %[[V_30]] : !fir.heap<i64>
9393
! CHECK: }
94-
! CHECK: %[[V_37]] = fir.call @_FortranAioBeginExternalListOutput
95-
! CHECK: %[[V_38]] = fir.load %[[V_4]] : !fir.ref<!fir.ptr<i64>>
96-
! CHECK: %[[V_39]] = fir.load %[[V_38]] : !fir.ptr<i64>
97-
! CHECK: %[[V_40]] = fir.call @_FortranAioOutputInteger64(%[[V_37]], %[[V_39]]) {{.*}}: (!fir.ref<i8>, i64) -> i1
94+
! CHECK: %[[V_37:[0-9]+]] = fir.call @_FortranAioBeginExternalListOutput
95+
! CHECK: %[[V_38:[0-9]+]] = fir.load %[[V_4]] : !fir.ref<!fir.ptr<i64>>
96+
! CHECK: %[[V_39:[0-9]+]] = fir.load %[[V_38]] : !fir.ptr<i64>
97+
! CHECK: %[[V_40:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_37]], %[[V_39]]) {{.*}}: (!fir.ref<i8>, i64) -> i1
9898
! CHECK: %[[V_41:[0-9]+]] = fir.load %[[V_1]] : !fir.ref<!fir.heap<i64>>
9999
! CHECK: %[[V_42:[0-9]+]] = fir.load %[[V_41]] : !fir.heap<i64>
100100
! CHECK: %[[V_43:[0-9]+]] = fir.call @_FortranAioOutputInteger64(%[[V_37]], %[[V_42]]) {{.*}}: (!fir.ref<i8>, i64) -> i1
@@ -120,13 +120,13 @@ subroutine ss(count)
120120
! CHECK: fir.store %[[V_29]] to %arg0 : !fir.ref<i64>
121121
! CHECK: }
122122
! CHECK: %[[V_24:[0-9]+]] = fir.convert %[[V_21]] : (!fir.ptr<i64>) -> i64
123-
! CHECK: %[[V_25:[0-9]+]] = arith.cmpi ne, %[[V_24]], %c0{{.*}}_i64_1 : i64
123+
! CHECK: %[[V_25:[0-9]+]] = arith.cmpi ne, %[[V_24]], %c0{{.*}} : i64
124124
! CHECK: fir.if %[[V_25]] {
125125
! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountRate(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
126126
! CHECK: fir.store %[[V_29]] to %[[V_21]] : !fir.ptr<i64>
127127
! CHECK: }
128128
! CHECK: %[[V_26:[0-9]+]] = fir.convert %[[V_22]] : (!fir.heap<i64>) -> i64
129-
! CHECK: %[[V_27:[0-9]+]] = arith.cmpi ne, %[[V_26]], %c0{{.*}}_i64_2 : i64
129+
! CHECK: %[[V_27:[0-9]+]] = arith.cmpi ne, %[[V_26]], %c0{{.*}} : i64
130130
! CHECK: fir.if %[[V_27]] {
131131
! CHECK: %[[V_29]] = fir.call @_FortranASystemClockCountMax(%c8{{.*}}_i32) {{.*}}: (i32) -> i64
132132
! CHECK: fir.store %[[V_29]] to %[[V_22]] : !fir.heap<i64>

flang/test/Lower/OpenMP/FIR/parallel-private-clause.f90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,20 @@ subroutine private_clause_allocatable()
146146
!FIRDialect-DAG: omp.parallel {
147147
!FIRDialect-DAG: [[TMP203:%.*]] = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "x5", pinned, uniq_name = "{{.*}}Ex5"}
148148

149-
!FIRDialect-DAG: fir.if %7 {
149+
!FIRDialect-DAG: fir.if %{{.*}} {
150150

151-
!FIRDialect-DAG: fir.store %13 to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
151+
!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
152152
!FIRDialect-DAG: } else {
153153

154-
!FIRDialect-DAG: fir.store %13 to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
154+
!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
155155
!FIRDialect-DAG: }
156156
!FIRDialect-DAG: fir.call @_QFprivate_clause_real_call_allocatablePhelper_private_clause_real_call_allocatable([[TMP203]]) fastmath<contract> : (!fir.ref<!fir.box<!fir.heap<f32>>>) -> ()
157-
!FIRDialect-DAG: %8 = fir.load [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
157+
!FIRDialect-DAG: %{{.*}} = fir.load [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
158158

159-
!FIRDialect-DAG: fir.if %11 {
160-
!FIRDialect-DAG: %12 = fir.load [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
159+
!FIRDialect-DAG: fir.if %{{.*}} {
160+
!FIRDialect-DAG: %{{.*}} = fir.load [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
161161

162-
!FIRDialect-DAG: fir.store %15 to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
162+
!FIRDialect-DAG: fir.store %{{.*}} to [[TMP203]] : !fir.ref<!fir.box<!fir.heap<f32>>>
163163
!FIRDialect-DAG: }
164164
!FIRDialect-DAG: omp.terminator
165165
!FIRDialect-DAG: }
@@ -353,9 +353,9 @@ subroutine simple_loop_3
353353
subroutine simd_loop_1
354354
integer :: i
355355
real, allocatable :: r;
356-
! IRDialect: [[R:%.*]] = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"}
357-
! IRDialect: fir.store {{%.*}} to [[R]] : !fir.ref<!fir.box<!fir.heap<f32>>>
358-
! IRDialect: fir.store {{%.*}} to [[R]] : !fir.ref<!fir.box<!fir.heap<f32>>>
356+
! FIRDialect: [[R:%.*]] = fir.alloca !fir.box<!fir.heap<f32>> {bindc_name = "r", pinned, uniq_name = "{{.*}}Er"}
357+
! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref<!fir.box<!fir.heap<f32>>>
358+
! FIRDialect: fir.store {{%.*}} to [[R]] : !fir.ref<!fir.box<!fir.heap<f32>>>
359359

360360
! FIRDialect: %[[LB:.*]] = arith.constant 1 : i32
361361
! FIRDialect: %[[UB:.*]] = arith.constant 9 : i32

0 commit comments

Comments
 (0)