[llvm] 912cdd2 - [DAG] AddNodeIDCustom - call ShuffleVectorSDNode::getMask once instead of repeated getMaskElt calls.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 04:09:04 PST 2024


Author: Simon Pilgrim
Date: 2024-01-31T12:01:01Z
New Revision: 912cdd2179783b67926d53adc77c12148076ddb2

URL: https://github.com/llvm/llvm-project/commit/912cdd2179783b67926d53adc77c12148076ddb2
DIFF: https://github.com/llvm/llvm-project/commit/912cdd2179783b67926d53adc77c12148076ddb2.diff

LOG: [DAG] AddNodeIDCustom - call ShuffleVectorSDNode::getMask once instead of repeated getMaskElt calls.

Use a simpler for-range loop to append all shuffle mask elements

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index a3d8d253437ca..3c1343836187a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -909,10 +909,9 @@ static void AddNodeIDCustom(FoldingSetNodeID &ID, const SDNode *N) {
     break;
   }
   case ISD::VECTOR_SHUFFLE: {
-    const ShuffleVectorSDNode *SVN = cast<ShuffleVectorSDNode>(N);
-    for (unsigned i = 0, e = N->getValueType(0).getVectorNumElements();
-         i != e; ++i)
-      ID.AddInteger(SVN->getMaskElt(i));
+    ArrayRef<int> Mask = cast<ShuffleVectorSDNode>(N)->getMask();
+    for (int M : Mask)
+      ID.AddInteger(M);
     break;
   }
   case ISD::TargetBlockAddress:


        


More information about the llvm-commits mailing list