[llvm] f952a84 - [TargetLowering] Use getShiftAmountConstant in buildSDIVPow2WithCMov.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 2 11:03:24 PDT 2025


Author: Craig Topper
Date: 2025-08-02T10:50:46-07:00
New Revision: f952a84f2f913c6f93a85af07e86b1a87778d349

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

LOG: [TargetLowering] Use getShiftAmountConstant in buildSDIVPow2WithCMov.

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 48d6b9996e572..e3f2a19313f36 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -6482,8 +6482,8 @@ SDValue TargetLowering::buildSDIVPow2WithCMov(
   Created.push_back(CMov.getNode());
 
   // Divide by pow2.
-  SDValue SRA =
-      DAG.getNode(ISD::SRA, DL, VT, CMov, DAG.getConstant(Lg2, DL, VT));
+  SDValue SRA = DAG.getNode(ISD::SRA, DL, VT, CMov,
+                            DAG.getShiftAmountConstant(Lg2, VT, DL));
 
   // If we're dividing by a positive value, we're done.  Otherwise, we must
   // negate the result.


        


More information about the llvm-commits mailing list