-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[SelectionDAG] Use correct result type in visitEXTRACT_VECTOR_ELT #148707
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
base: main
Are you sure you want to change the base?
[SelectionDAG] Use correct result type in visitEXTRACT_VECTOR_ELT #148707
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) ChangesIn If the DAG has these two nodes (this is generated from
It could apply this combiner rule (i.e.,
This PR will fix this issue. Full diff: https://github.com/llvm/llvm-project/pull/148707.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8136f1794775e..f26ee0ace6919 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -23440,10 +23440,10 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// If Idx was -1 above, Elt is going to be -1, so just return undef.
if (Elt == -1)
- return DAG.getUNDEF(LVT);
+ return DAG.getUNDEF(ScalarVT);
- if (SDValue Scalarized =
- TLI.scalarizeExtractedVectorLoad(LVT, DL, VecVT, Index, LN0, DAG)) {
+ if (SDValue Scalarized = TLI.scalarizeExtractedVectorLoad(ScalarVT, DL, VecVT,
+ Index, LN0, DAG)) {
++OpsNarrowed;
return Scalarized;
}
|
Was that supposed to be |
Do you have a test case? |
I don't have one right now. I need to make up one with public targets, but I'm unfamiliar with public targets yet. (or anyone can help? Thanks!) This PR is extremely similar with this regression fix, so also cc @arsenm . |
LGTM but should be tested. I think ARM makes the most use of the illegal-scalar-type vectors |
In
visitEXTRACT_VECTOR_ELT
, we should useScalarVT
instead ofLVT
as the result VT for return and method call.If the DAG has these two nodes (this is generated from
llvm-project/llvm/test/CodeGen/Generic/extractelement-shuffle.ll
):It could apply this combiner rule (i.e.,
(vextract (v4i32 load $addr), c) -> (i32 load $addr+c*size)
) then hit a failure:This PR will fix this issue.