[llvm] [RISCV] Flatten the ImpliedExts table in RISCVISAInfo.cpp (PR #89975)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 13:59:06 PDT 2024


================
@@ -880,17 +886,17 @@ void RISCVISAInfo::updateImplication() {
 
   while (!WorkList.empty()) {
     StringRef ExtName = WorkList.pop_back_val();
-    auto I = llvm::lower_bound(ImpliedExts, ExtName);
-    if (I != std::end(ImpliedExts) && I->Name == ExtName) {
-      for (const char *ImpliedExt : I->Exts) {
-        if (WorkList.count(ImpliedExt))
-          continue;
-        if (Exts.count(ImpliedExt))
-          continue;
-        auto Version = findDefaultVersion(ImpliedExt);
-        addExtension(ImpliedExt, Version.value());
-        WorkList.insert(ImpliedExt);
-      }
+    auto Range = std::equal_range(std::begin(ImpliedExts),
+                                  std::end(ImpliedExts), ExtName);
+    for (auto I = Range.first, E = Range.second; I != E; ++I) {
----------------
preames wrote:

I think you could use a foreach style loop here?

https://github.com/llvm/llvm-project/pull/89975


More information about the llvm-commits mailing list