Skip to content

Commit 7d7e255

Browse files
jeanPerierchencha3
authored andcommitted
[flang] Enable polymorphic lowering by default (llvm#83285)
Polymorphic entity lowering status is good. The main remaining TODO is to allow lowering of vector subscripted polymorphic entity, but this does not deserve blocking all application using polymorphism. Remove experimental option and enable lowering of polymorphic entity by default.
1 parent 4ca4760 commit 7d7e255

File tree

68 files changed

+63
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+63
-107
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6441,11 +6441,6 @@ def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
64416441
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
64426442
HelpText<"Do not use HLFIR lowering (deprecated)">;
64436443

6444-
def flang_experimental_polymorphism : Flag<["-"], "flang-experimental-polymorphism">,
6445-
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
6446-
HelpText<"Enable Fortran 2003 polymorphism (experimental)">;
6447-
6448-
64496444
//===----------------------------------------------------------------------===//
64506445
// FLangOption + CoreOption + NoXarchOption
64516446
//===----------------------------------------------------------------------===//

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ void Flang::addCodegenOptions(const ArgList &Args,
148148

149149
Args.addAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir,
150150
options::OPT_flang_deprecated_no_hlfir,
151-
options::OPT_flang_experimental_polymorphism,
152151
options::OPT_fno_ppc_native_vec_elem_order,
153152
options::OPT_fppc_native_vec_elem_order});
154153
}

flang/include/flang/Lower/LoweringOptions.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ LOWERINGOPT(Name, Bits, Default)
2424
/// If true, lower transpose without a runtime call.
2525
ENUM_LOWERINGOPT(OptimizeTranspose, unsigned, 1, 1)
2626

27-
/// If true, enable polymorphic type lowering feature. On by default.
28-
ENUM_LOWERINGOPT(PolymorphicTypeImpl, unsigned, 1, 1)
29-
3027
/// If true, lower to High level FIR before lowering to FIR. On by default.
3128
ENUM_LOWERINGOPT(LowerToHighLevelFIR, unsigned, 1, 1)
3229

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,11 +1191,6 @@ bool CompilerInvocation::createFromArgs(
11911191
invoc.loweringOpts.setLowerToHighLevelFIR(false);
11921192
}
11931193

1194-
if (args.hasArg(
1195-
clang::driver::options::OPT_flang_experimental_polymorphism)) {
1196-
invoc.loweringOpts.setPolymorphicTypeImpl(true);
1197-
}
1198-
11991194
// -fno-ppc-native-vector-element-order
12001195
if (args.hasArg(clang::driver::options::OPT_fno_ppc_native_vec_elem_order)) {
12011196
invoc.loweringOpts.setNoPPCNativeVecElemOrder(true);

flang/lib/Lower/CallInterface.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,12 +1050,6 @@ class Fortran::lower::CallInterfaceImpl {
10501050
Fortran::common::TypeCategory cat = dynamicType.category();
10511051
// DERIVED
10521052
if (cat == Fortran::common::TypeCategory::Derived) {
1053-
// TODO is kept under experimental flag until feature is complete.
1054-
if (dynamicType.IsPolymorphic() &&
1055-
!getConverter().getLoweringOptions().getPolymorphicTypeImpl())
1056-
TODO(interface.converter.getCurrentLocation(),
1057-
"support for polymorphic types");
1058-
10591053
if (dynamicType.IsUnlimitedPolymorphic())
10601054
return mlir::NoneType::get(&mlirContext);
10611055
return getConverter().genType(dynamicType.GetDerivedTypeSpec());

flang/lib/Lower/ConvertType.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,6 @@ struct TypeBuilderImpl {
263263
llvm::SmallVector<Fortran::lower::LenParameterTy> params;
264264
translateLenParameters(params, tySpec->category(), ultimate);
265265
ty = genFIRType(context, tySpec->category(), kind, params);
266-
} else if (type->IsPolymorphic() &&
267-
!converter.getLoweringOptions().getPolymorphicTypeImpl()) {
268-
// TODO is kept under experimental flag until feature is complete.
269-
TODO(loc, "support for polymorphic types");
270266
} else if (type->IsUnlimitedPolymorphic()) {
271267
ty = mlir::NoneType::get(context);
272268
} else if (const Fortran::semantics::DerivedTypeSpec *tySpec =

flang/test/Driver/driver-help-hidden.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
! CHECK-NEXT: Do not use HLFIR lowering (deprecated)
5353
! CHECK-NEXT: -flang-experimental-hlfir
5454
! CHECK-NEXT: Use HLFIR lowering (experimental)
55-
! CHECK-NEXT: -flang-experimental-polymorphism
56-
! CHECK-NEXT: Enable Fortran 2003 polymorphism (experimental)
5755
! CHECK-NEXT: -flarge-sizes Use INTEGER(KIND=8) for the result type in size-related intrinsics
5856
! CHECK-NEXT: -flogical-abbreviations Enable logical abbreviations
5957
! CHECK-NEXT: -flto=auto Enable LTO in 'full' mode

flang/test/Driver/flang-experimental-polymorphism-flag.f90

Lines changed: 0 additions & 10 deletions
This file was deleted.

flang/test/Driver/frontend-forwarding.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
! RUN: -fomit-frame-pointer \
1818
! RUN: -fpass-plugin=Bye%pluginext \
1919
! RUN: -fversion-loops-for-stride \
20-
! RUN: -flang-experimental-polymorphism \
2120
! RUN: -flang-experimental-hlfir \
2221
! RUN: -flang-deprecated-no-hlfir \
2322
! RUN: -fno-ppc-native-vector-element-order \
@@ -49,7 +48,6 @@
4948
! CHECK: "-fconvert=little-endian"
5049
! CHECK: "-fpass-plugin=Bye
5150
! CHECK: "-fversion-loops-for-stride"
52-
! CHECK: "-flang-experimental-polymorphism"
5351
! CHECK: "-flang-experimental-hlfir"
5452
! CHECK: "-flang-deprecated-no-hlfir"
5553
! CHECK: "-fno-ppc-native-vector-element-order"

flang/test/Fir/dispatch.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
! RUN: bbc -polymorphic-type -emit-hlfir %s -o - | fir-opt --fir-polymorphic-op | FileCheck %s
2-
! RUN: bbc -polymorphic-type -emit-hlfir %s -o - | FileCheck %s --check-prefix=BT
1+
! RUN: bbc -emit-hlfir %s -o - | fir-opt --fir-polymorphic-op | FileCheck %s
2+
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s --check-prefix=BT
33

44
! Tests codegen of fir.dispatch operation. This test is intentionally run from
55
! Fortran through bbc and tco so we have all the binding tables lowered to FIR

0 commit comments

Comments
 (0)