diff options
author | jacquesguan <Jianjian.Guan@streamcomputing.com> | 2022-07-14 10:41:42 +0800 |
---|---|---|
committer | jacquesguan <Jianjian.Guan@streamcomputing.com> | 2022-07-26 09:31:45 +0800 |
commit | cb370cf41374de4ab3d522b480aa7af118098f1f (patch) | |
tree | a75c2ab161154d4a405f53ba6abe21eee2dd443f /llvm/lib/CodeGen | |
parent | Revert "[LLDB][NFC][Reliability] Fix uninitialized variables from Coverity sc... (diff) | |
download | llvm-project-cb370cf41374de4ab3d522b480aa7af118098f1f.tar.gz llvm-project-cb370cf41374de4ab3d522b480aa7af118098f1f.tar.bz2 llvm-project-cb370cf41374de4ab3d522b480aa7af118098f1f.zip |
[DAGCombiner] Teach scalarizeExtractedBinop to support scalable splat.
This patch supports the scalable splat part for scalarizeExtractedBinop.
Differential Revision: https://reviews.llvm.org/D129725
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 3b18e3249d94..c16336eee65b 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -19711,8 +19711,11 @@ static SDValue scalarizeExtractedBinop(SDNode *ExtElt, SelectionDAG &DAG, // extract. SDValue Op0 = Vec.getOperand(0); SDValue Op1 = Vec.getOperand(1); + APInt SplatVal; if (isAnyConstantBuildVector(Op0, true) || - isAnyConstantBuildVector(Op1, true)) { + ISD::isConstantSplatVector(Op0.getNode(), SplatVal) || + isAnyConstantBuildVector(Op1, true) || + ISD::isConstantSplatVector(Op1.getNode(), SplatVal)) { // extractelt (binop X, C), IndexC --> binop (extractelt X, IndexC), C' // extractelt (binop C, X), IndexC --> binop C', (extractelt X, IndexC) SDLoc DL(ExtElt); @@ -19789,6 +19792,9 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) { // converts. } + if (SDValue BO = scalarizeExtractedBinop(N, DAG, LegalOperations)) + return BO; + if (VecVT.isScalableVector()) return SDValue(); @@ -19834,9 +19840,6 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) { } } - if (SDValue BO = scalarizeExtractedBinop(N, DAG, LegalOperations)) - return BO; - // Transform: (EXTRACT_VECTOR_ELT( VECTOR_SHUFFLE )) -> EXTRACT_VECTOR_ELT. // We only perform this optimization before the op legalization phase because // we may introduce new vector instructions which are not backed by TD |