@@ -1727,9 +1727,9 @@ static void findCSKYMultilibs(const Driver &D, const llvm::Triple &TargetTriple,
17271727// / march=rv32ima are not compatible, because software and hardware
17281728// / atomic operation can't work together correctly.
17291729static bool
1730- RISCVMultilibSelect (const MultilibSet &RISCVMultilibSet, StringRef Arch,
1730+ selectRISCVMultilib (const MultilibSet &RISCVMultilibSet, StringRef Arch,
17311731 const Multilib::flags_list &Flags,
1732- llvm::SmallVector <Multilib> &SelectedMultilibs) {
1732+ llvm::SmallVectorImpl <Multilib> &SelectedMultilibs) {
17331733 // Try to find the perfect matching multi-lib first.
17341734 if (RISCVMultilibSet.select (Flags, SelectedMultilibs))
17351735 return true ;
@@ -1763,28 +1763,28 @@ RISCVMultilibSelect(const MultilibSet &RISCVMultilibSet, StringRef Arch,
17631763 llvm::StringSet<> AllArchExts;
17641764 // Reconstruct multi-lib list, and break march option into separated
17651765 // extension. e.g. march=rv32im -> +i +m
1766- for (auto M : RISCVMultilibSet) {
1766+ for (const auto & M : RISCVMultilibSet) {
17671767 bool Skip = false ;
17681768
17691769 MultilibBuilder NewMultilib =
17701770 MultilibBuilder (M.gccSuffix (), M.osSuffix (), M.includeSuffix ());
17711771 for (StringRef Flag : M.flags ()) {
1772- // Add back the all option except -march.
1773- if (!Flag.startswith (" -march=" )) {
1772+ // Add back all flags except -march.
1773+ if (!Flag.consume_front (" -march=" )) {
17741774 NewMultilib.flag (Flag);
17751775 continue ;
17761776 }
17771777
17781778 // Break down -march into individual extension.
17791779 llvm::Expected<std::unique_ptr<llvm::RISCVISAInfo>> MLConfigParseResult =
17801780 llvm::RISCVISAInfo::parseArchString (
1781- Flag. drop_front ( 7 ) , /* EnableExperimentalExtension=*/ true ,
1781+ Flag, /* EnableExperimentalExtension=*/ true ,
17821782 /* ExperimentalExtensionVersionCheck=*/ false );
17831783 if (!MLConfigParseResult) {
17841784 // Ignore any error here, we assume it will handled in another place.
17851785 llvm::consumeError (MLConfigParseResult.takeError ());
17861786
1787- // We might get parsing error if rv32e in the list, we could just skip
1787+ // We might get a parsing error if rv32e in the list, we could just skip
17881788 // that and process the rest of multi-lib configs.
17891789 Skip = true ;
17901790 continue ;
@@ -1797,8 +1797,7 @@ RISCVMultilibSelect(const MultilibSet &RISCVMultilibSet, StringRef Arch,
17971797 auto ExtName = MLConfigArchExt.first ;
17981798 NewMultilib.flag (Twine (" -" , ExtName).str ());
17991799
1800- if (!AllArchExts.contains (ExtName)) {
1801- AllArchExts.insert (ExtName);
1800+ if (AllArchExts.insert (ExtName).second ) {
18021801 addMultilibFlag (ISAInfo->hasExtension (ExtName),
18031802 Twine (" -" , ExtName).str (), NewFlags);
18041803 }
@@ -1832,7 +1831,7 @@ RISCVMultilibSelect(const MultilibSet &RISCVMultilibSet, StringRef Arch,
18321831
18331832 if (NewRISCVMultilibs.select (NewFlags, SelectedMultilibs))
18341833 for (const Multilib &NewSelectedM : SelectedMultilibs)
1835- for (auto M : RISCVMultilibSet)
1834+ for (const auto & M : RISCVMultilibSet)
18361835 // Look up the corresponding multi-lib entry in original multi-lib set.
18371836 if (M.gccSuffix () == NewSelectedM.gccSuffix ())
18381837 return true ;
@@ -1891,7 +1890,7 @@ static void findRISCVBareMetalMultilibs(const Driver &D,
18911890 }
18921891 }
18931892
1894- if (RISCVMultilibSelect (RISCVMultilibs, MArch, Flags,
1893+ if (selectRISCVMultilib (RISCVMultilibs, MArch, Flags,
18951894 Result.SelectedMultilibs ))
18961895 Result.Multilibs = RISCVMultilibs;
18971896}
0 commit comments