Skip to content

Commit d285ded

Browse files
Clean up in lowering to switch to the new checks
1 parent aa65a3e commit d285ded

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

flang/lib/Lower/ConvertCall.cpp

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,18 +1161,6 @@ mlir::Value static getZeroLowerBounds(mlir::Location loc,
11611161
return builder.genShift(loc, lowerBounds);
11621162
}
11631163

1164-
static bool
1165-
isSimplyContiguous(const Fortran::evaluate::ActualArgument &arg,
1166-
Fortran::evaluate::FoldingContext &foldingContext) {
1167-
if (const auto *expr = arg.UnwrapExpr())
1168-
return Fortran::evaluate::IsSimplyContiguous(*expr, foldingContext);
1169-
const Fortran::semantics::Symbol *sym = arg.GetAssumedTypeDummy();
1170-
assert(sym &&
1171-
"expect ActualArguments to be expression or assumed-type symbols");
1172-
return sym->Rank() == 0 ||
1173-
Fortran::evaluate::IsSimplyContiguous(*sym, foldingContext);
1174-
}
1175-
11761164
static bool isParameterObjectOrSubObject(hlfir::Entity entity) {
11771165
mlir::Value base = entity;
11781166
bool foundParameter = false;
@@ -1215,9 +1203,6 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
12151203
const Fortran::lower::CallerInterface::PassedEntity &arg,
12161204
CallContext &callContext) {
12171205

1218-
Fortran::evaluate::FoldingContext &foldingContext =
1219-
callContext.converter.getFoldingContext();
1220-
12211206
// Step 1: get the actual argument, which includes addressing the
12221207
// element if this is an array in an elemental call.
12231208
hlfir::Entity actual = preparedActual.getActual(loc, builder);
@@ -1258,25 +1243,8 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
12581243
passingPolymorphicToNonPolymorphic &&
12591244
(actual.isArray() || mlir::isa<fir::BaseBoxType>(dummyType));
12601245

1261-
// The simple contiguity of the actual is "lost" when passing a polymorphic
1262-
// to a non polymorphic entity because the dummy dynamic type matters for
1263-
// the contiguity.
1264-
bool mustDoCopyIn = actual.isArray() && arg.mustBeMadeContiguous() &&
1265-
(passingPolymorphicToNonPolymorphic ||
1266-
!isSimplyContiguous(*arg.entity, foldingContext));
1267-
bool mustDoCopyOut = mustDoCopyIn && arg.mayBeModifiedByCall();
1268-
bool newMustDoCopyIn = false;
1269-
bool newMustDoCopyOut = false;
1270-
newMustDoCopyIn = actual.isArray() && arg.entity->GetMayNeedCopyIn();
1271-
newMustDoCopyOut = newMustDoCopyIn && arg.entity->GetMayNeedCopyOut();
1272-
#if 1
1273-
llvm::dbgs() << "copyinout: CALLER " << "copy-in: old=" << mustDoCopyIn
1274-
<< ", new=" << newMustDoCopyIn
1275-
<< "| copy-out: old=" << mustDoCopyOut
1276-
<< ", new=" << newMustDoCopyOut << "\n";
1277-
#endif
1278-
mustDoCopyIn = newMustDoCopyIn;
1279-
mustDoCopyOut = newMustDoCopyOut;
1246+
bool mustDoCopyIn = actual.isArray() && arg.entity->GetMayNeedCopyIn();
1247+
bool mustDoCopyOut = mustDoCopyIn && arg.entity->GetMayNeedCopyOut();
12801248

12811249
const bool actualIsAssumedRank = actual.isAssumedRank();
12821250
// Create dummy type with actual argument rank when the dummy is an assumed

0 commit comments

Comments
 (0)