[llvm] 7e07c1d - [DAG] expandAVG - consistently use getShiftAmountConstant for constant shift amounts. NFC

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 01:26:31 PDT 2024


Author: Simon Pilgrim
Date: 2024-09-10T09:25:58+01:00
New Revision: 7e07c1df678825c6a57d5fb1d36cdfc1584de9dc

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

LOG: [DAG] expandAVG - consistently use getShiftAmountConstant for constant shift amounts. NFC

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 2b41b8a9a810e5..b3307dc9b77304 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -9557,13 +9557,13 @@ SDValue TargetLowering::expandAVG(SDNode *N, SelectionDAG &DAG) const {
     SDValue Overflow = UAddWithOverflow.getValue(1);
 
     // Right shift the sum by 1
-    SDValue One = DAG.getShiftAmountConstant(1, VT, dl);
-    SDValue LShrVal = DAG.getNode(ISD::SRL, dl, VT, Sum, One);
+    SDValue LShrVal = DAG.getNode(ISD::SRL, dl, VT, Sum,
+                                  DAG.getShiftAmountConstant(1, VT, dl));
 
     SDValue ZeroExtOverflow = DAG.getNode(ISD::ANY_EXTEND, dl, VT, Overflow);
-    SDValue OverflowShl =
-        DAG.getNode(ISD::SHL, dl, VT, ZeroExtOverflow,
-                    DAG.getConstant(VT.getScalarSizeInBits() - 1, dl, VT));
+    SDValue OverflowShl = DAG.getNode(
+        ISD::SHL, dl, VT, ZeroExtOverflow,
+        DAG.getShiftAmountConstant(VT.getScalarSizeInBits() - 1, VT, dl));
 
     return DAG.getNode(ISD::OR, dl, VT, LShrVal, OverflowShl);
   }


        


More information about the llvm-commits mailing list