[llvm] cdd3214 - [TargetLowering] Use getShiftAmountConstant. NFC (#123802)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 12:05:58 PST 2025


Author: Craig Topper
Date: 2025-01-21T12:05:52-08:00
New Revision: cdd321462aecf3a37b683d594a533a17e72a09e9

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

LOG: [TargetLowering] Use getShiftAmountConstant. NFC (#123802)

Previously we always used the pointer size which might need to be
legalized on some targets.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 368800d8b46a87..5861a95c090b1d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -10959,12 +10959,9 @@ void TargetLowering::forceExpandWideMUL(SelectionDAG &DAG, const SDLoc &dl,
     // The high part is obtained by SRA'ing all but one of the bits of low
     // part.
     unsigned LoSize = VT.getFixedSizeInBits();
-    HiLHS = DAG.getNode(
-        ISD::SRA, dl, VT, LHS,
-        DAG.getConstant(LoSize - 1, dl, getPointerTy(DAG.getDataLayout())));
-    HiRHS = DAG.getNode(
-        ISD::SRA, dl, VT, RHS,
-        DAG.getConstant(LoSize - 1, dl, getPointerTy(DAG.getDataLayout())));
+    SDValue Shift = DAG.getShiftAmountConstant(LoSize - 1, VT, dl);
+    HiLHS = DAG.getNode(ISD::SRA, dl, VT, LHS, Shift);
+    HiRHS = DAG.getNode(ISD::SRA, dl, VT, RHS, Shift);
   } else {
     HiLHS = DAG.getConstant(0, dl, VT);
     HiRHS = DAG.getConstant(0, dl, VT);


        


More information about the llvm-commits mailing list