[llvm] 685e190 - [LegalizeDAG] Use scalable aware idiom for checking for single element vector

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 11:56:10 PDT 2023


Author: Philip Reames
Date: 2023-09-01T11:56:03-07:00
New Revision: 685e1909e98a8e4c267ea1f7c788559d40b80654

URL: https://github.com/llvm/llvm-project/commit/685e1909e98a8e4c267ea1f7c788559d40b80654
DIFF: https://github.com/llvm/llvm-project/commit/685e1909e98a8e4c267ea1f7c788559d40b80654.diff

LOG: [LegalizeDAG] Use scalable aware idiom for checking for single element vector

NFC for fixed vectors (all that reaches here currently), and future proofing for scalable vectors.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index a8d3732ef7306e..0002d0e61b18e1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3333,7 +3333,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
     Results.push_back(DAG.expandVACopy(Node));
     break;
   case ISD::EXTRACT_VECTOR_ELT:
-    if (Node->getOperand(0).getValueType().getVectorNumElements() == 1)
+    if (Node->getOperand(0).getValueType().getVectorElementCount().isScalar())
       // This must be an access of the only element.  Return it.
       Tmp1 = DAG.getNode(ISD::BITCAST, dl, Node->getValueType(0),
                          Node->getOperand(0));


        


More information about the llvm-commits mailing list