-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[LLVM][SelectionDAGBuilder] Add initial DAG for target("aarch64.svcount") constants to the node cache. #126089
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-llvm-selectiondag Author: Da Li (李达) (dlee992) ChangesAs title. cc @paulwalker-arm Full diff: https://github.com/llvm/llvm-project/pull/126089.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4e1ce6af3abc84..2c175ff621bea0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1893,8 +1893,9 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
if (VT == MVT::aarch64svcount) {
assert(C->isNullValue() && "Can only zero this target type!");
- return DAG.getNode(ISD::BITCAST, getCurSDLoc(), VT,
- DAG.getConstant(0, getCurSDLoc(), MVT::nxv16i1));
+ return NodeMap[V] =
+ DAG.getNode(ISD::BITCAST, getCurSDLoc(), VT,
+ DAG.getConstant(0, getCurSDLoc(), MVT::nxv16i1));
}
if (VT.isRISCVVectorTuple()) {
|
@dlee992 - Would you like me to merge this PR? |
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.
Testcase?
Is a test case necessary? It's an obvious non-breaking omission that I wouldn't have written a test case for if I had not originally omitted the code. |
Description needs to be fixed, I don't understand the point of this and commit message reading shouldn't require parsing through some other thread |
I think this PR doesn't need a new testcase, since #69321 has added the needed test cases. I updated the PR description, hope it's good to go. |
The description still doesn't state what issue this is solving |
NodeMap[V]
for svcount
in SelectionDAGBuilder
Wouldn't SelectionDAG CSE the duplicate nodes anyway? So at best this is probably a cheaper cache than the FoldingSet used for CSE? |
Both of the callers of ValueImpl write the return value to NodeMap. Now I'm not sure why there are any writes to NodeMap in this function. |
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 don't think this patch is needed and I'm going to remove the other NodeMap updates from getValueImpl. Patch #126849
I think you're right! I will close this wrong patch. |
#126089 forgot to update
NodeMap
when building the initial DAG, which could result in duplicate identical nodes.