[llvm] [TableGen][SubtargetEmitter] Early exit from loop in FindWriteResources and FindReadAdvance (PR #92202)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 10:30:14 PDT 2024
================
@@ -902,8 +902,14 @@ 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")) {
----------------
topperc wrote:
While you're here can we cache `WR->getValueAsDef("WriteType")` in a local variable. We call it twice.
https://github.com/llvm/llvm-project/pull/92202
More information about the llvm-commits
mailing list