Skip to content

Commit 0e93801

Browse files
committed
[RISCV] Speed up RISCVISAInfo::updateImplication.
We don't need to use a SmallSetVector to keep track of the worklist. We only insert into the worklist if the extension is not already in the Exts map. We immediately add it the Exts map at the same time we add it to the worklist. If we encounter the extension again it will already be in Exts so we won't try to add it to the worklist again. We can just use a SmallVector for the Worklist.
1 parent 3e53c97 commit 0e93801

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -840,9 +840,9 @@ void RISCVISAInfo::updateImplication() {
840840

841841
// This loop may execute over 1 iteration since implication can be layered
842842
// Exits loop if no more implication is applied
843-
SmallSetVector<StringRef, 16> WorkList;
843+
SmallVector<StringRef, 16> WorkList;
844844
for (auto const &Ext : Exts)
845-
WorkList.insert(Ext.first);
845+
WorkList.push_back(Ext.first);
846846

847847
while (!WorkList.empty()) {
848848
StringRef ExtName = WorkList.pop_back_val();
@@ -851,13 +851,11 @@ void RISCVISAInfo::updateImplication() {
851851
std::for_each(Range.first, Range.second,
852852
[&](const ImpliedExtsEntry &Implied) {
853853
const char *ImpliedExt = Implied.ImpliedExt;
854-
if (WorkList.count(ImpliedExt))
855-
return;
856854
if (Exts.count(ImpliedExt))
857855
return;
858856
auto Version = findDefaultVersion(ImpliedExt);
859857
addExtension(ImpliedExt, *Version);
860-
WorkList.insert(ImpliedExt);
858+
WorkList.push_back(ImpliedExt);
861859
});
862860
}
863861

0 commit comments

Comments
 (0)