[llvm] [TableGen][SubtargetEmitter] Early exit from loop in FindWriteResources and FindReadAdvance (PR #92202)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 10:27:37 PDT 2024


================
@@ -902,8 +902,13 @@ SubtargetEmitter::FindWriteResources(const CodeGenSchedRW &SchedWrite,
   for (Record *WR : ProcModel.WriteResDefs) {
     if (!WR->isSubClassOf("WriteRes"))
       continue;
-    if (AliasDef == WR->getValueAsDef("WriteType") ||
-        SchedWrite.TheDef == WR->getValueAsDef("WriteType")) {
+    // If there is no AliasDef and we find a match, we can early exit since
+    // there is no need to verify whether there are resources defined for both
+    // SchedWrite and its alias.
+    if (!AliasDef && SchedWrite.TheDef == WR->getValueAsDef("WriteType")) {
+      ResDef = WR;
+      break;
+    } else if (AliasDef == WR->getValueAsDef("WriteType")) {
----------------
michaelmaitland wrote:

updated

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


More information about the llvm-commits mailing list