Skip to content

Commit 1a59a57

Browse files
RichBarton-Armbryanpkc
authored andcommitted
[flang-driver] Uniquify the target_features string
Use existing clang support for uniquifying target feature lists to pass a unique list through to flang.
1 parent 08ba37e commit 1a59a57

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Driver/ToolChains/ClassicFlang.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,11 +989,10 @@ void ClassicFlang::ConstructJob(Compilation &C, const JobAction &JA,
989989
std::string FeatureList = "";
990990
getTargetFeatureList(D, Triple, Args, UpperCmdArgs, false, Features);
991991
if (!Features.empty()) {
992-
for (unsigned I = 0, N = Features.size(); I < N; ++I) {
993-
StringRef Name = Features[I];
994-
FeatureList += Name.str();
995-
if (I < (N - 1))
992+
for (auto Feature : unifyTargetFeatures(Features)) {
993+
if (!FeatureList.empty())
996994
FeatureList += ',';
995+
FeatureList += Feature;
997996
}
998997

999998
LowerCmdArgs.push_back("-target_features");

clang/test/Driver/emit-flang-attrs.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %flang -### -target aarch64-linux-gnu -march=armv8-a -c %s 2>&1 | FileCheck --check-prefix=CHECK-ATTRS-NEON %s
44
// RUN: %flang -### -target aarch64-linux-gnu -march=armv8-a+sve -c %s 2>&1 | FileCheck --check-prefix=CHECK-ATTRS-SVE %s
55
// RUN: %flang -### -target aarch64-linux-gnu -march=armv8-a+nosve -c %s 2>&1 | FileCheck --check-prefix=CHECK-ATTRS-NOSVE %s
6+
// RUN: %flang -### -target aarch64-linux-gnu -march=armv8-a+sve+nosve -c %s 2>&1 | FileCheck --check-prefix=CHECK-ATTRS-NOSVE %s
67
// CHECK-ATTRS-NEON: "{{.*}}flang2"
78
// CHECK-ATTRS-NEON-SAME: "-target_features" "+neon,+v8a
89
// CHECK-ATTRS-SVE: "{{.*}}flang2"

0 commit comments

Comments
 (0)