[llvm] 8c67d25 - [X86] combineGatherScatter - pull out repeated variables. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 05:14:58 PDT 2025


Author: Simon Pilgrim
Date: 2025-05-14T13:12:20+01:00
New Revision: 8c67d2568124e8c1fcdef06e69e388ae489c728c

URL: https://github.com/llvm/llvm-project/commit/8c67d2568124e8c1fcdef06e69e388ae489c728c
DIFF: https://github.com/llvm/llvm-project/commit/8c67d2568124e8c1fcdef06e69e388ae489c728c.diff

LOG: [X86] combineGatherScatter - pull out repeated variables. NFC.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ef5838fbef6ae..8c6c987c552cc 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -56708,10 +56708,11 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
   SDValue Scale = GorS->getScale();
   EVT IndexVT = Index.getValueType();
   EVT IndexSVT = IndexVT.getVectorElementType();
+  unsigned IndexWidth = Index.getScalarValueSizeInBits();
   const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+  EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
 
   if (DCI.isBeforeLegalize()) {
-    unsigned IndexWidth = Index.getScalarValueSizeInBits();
     // Attempt to move shifted index into the address scale, allows further
     // index truncation below.
     if (Index.getOpcode() == ISD::SHL && isa<ConstantSDNode>(Scale)) {
@@ -56774,8 +56775,6 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
     }
   }
 
-  EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
-
   // Try to move splat adders from the index operand to the base
   // pointer operand. Taking care to multiply by the scale. We can only do
   // this when index element type is the same as the pointer type.
@@ -56823,8 +56822,6 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
   }
 
   if (DCI.isBeforeLegalizeOps()) {
-    unsigned IndexWidth = Index.getScalarValueSizeInBits();
-
     // Make sure the index is either i32 or i64
     if (IndexWidth != 32 && IndexWidth != 64) {
       MVT EltVT = IndexWidth > 32 ? MVT::i64 : MVT::i32;


        


More information about the llvm-commits mailing list