-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[TableGen][SubtargetEmitter] Early exit from loop in FindWriteResources and FindReadAdvance #92202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TableGen][SubtargetEmitter] Early exit from loop in FindWriteResources and FindReadAdvance #92202
Conversation
@@ -910,6 +910,7 @@ SubtargetEmitter::FindWriteResources(const CodeGenSchedRW &SchedWrite, | |||
ProcModel.ModelName); | |||
} | |||
ResDef = WR; | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this make the PrintFatalError dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed up. Need to take a second look at this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have addressed this problem
This gives us a 26% speed improvement in our downstream.
d947224
to
3fc1d3e
Compare
3fc1d3e
to
3432c73
Compare
3432c73
to
6b710d0
Compare
if (!AliasDef && SchedWrite.TheDef == WR->getValueAsDef("WriteType")) { | ||
ResDef = WR; | ||
break; | ||
} else if (AliasDef == WR->getValueAsDef("WriteType")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No else needed after break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
✅ With the latest revision this PR passed the C/C++ code formatter. |
// there is no need to verify whether there are resources defined for both | ||
// SchedWrite and its alias. | ||
Record *WRDef = WR->getValueAsDef("WriteType"); | ||
if (!AliasDef && SchedWrite.TheDef == WRDef) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if AliasDef is non-null. We won't update ResDef if SchedWrite.TheDef == WRDef.
if (!AliasDef && SchedWrite.TheDef == WRDef) { | |
Record *WRDef = WR->getValueAsDef("WriteType"); | |
if (AliasDef == WRDef || SchedWrite.TheDef == WRDef) { | |
if (ResDef) | |
PrintFatalError... | |
ResDef = WR; | |
// If there is no AliasDef and we find a match, we can early exit... | |
if (!AliasDef) | |
break; |
4ffd8fa
to
2b6aa35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This gives us a 30% speed improvement in our downstream.