-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[DAG] SDPatternMatch - add m_SpecificFP matcher #167438
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
Conversation
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
bcd3afc to
485284a
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.
You need to use m_c_BinOp if you want to test for commutation - otherwise you need to swap the operand matchers (or you can add another test and do both!)
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.
Sure.
RKSimon
left a comment
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.
Fix unit tests
1229219 to
0c9d220
Compare
🐧 Linux x64 Test Results
|
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.
| if (ConstantFPSDNode *C = isConstOrConstSplatFP(V, /*AllowUndefs=*/true)) |
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.
Done
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.
Is this useful?
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.
Sorry, did get the question. I guess you forgot to link the code snippet
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.
Sorry, I meant why would I use m_SpecificFP(SDValue) and not just m_Specific(SDValue)?
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.
Ahh. Ok, I understood. Ok, I removed m_SpecificFP(SDValue)
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.
TBH I'd prefer to use a APFloat for matching instead of converting to/from double
@mshockwave thoughts?
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.
yeah we can provide a double version of m_SpecificFP (which you did) but for the matcher class I prefer using APFloat as well. SpecificInt_match also uses APInt.
(also, why std::optional<double>?)
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.
yeah we can provide a double version of m_SpecificFP (which you did) but for the matcher class I prefer using APFloat as well.
Done
(also, why std::optional?)
removed. That was an artifact from a previous impl.
0c9d220 to
7771c1b
Compare
b185199 to
b7fc120
Compare
|
@RKSimon @mshockwave could you have a second look? (The re-review button doesn't show up in my case) |
RKSimon
left a comment
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.
Add some EXPECT_FALSE negative tests and m_SpecificFP(double) test coverage
b7fc120 to
119fb77
Compare
119fb77 to
55f6ac8
Compare
|
@RKSimon thanks for the review. Do we have to wait for @mshockwave or can I just merge? |
|
Ok to merge. Cheers |
This patch introduces SpecificFP matcher for SelectionDAG nodes.
This includes:
Adding SpecificFP_match() in SDPatternMatch.h.
Adding test coverage in SelectionDAGPatternMatchTest.cpp.
Closes #165566