[llvm] a3c5c83 - [DAGCombiner] Remove unneeded getValueType() calls in visitMULHS/MULHU. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 13:36:31 PDT 2024


Author: Craig Topper
Date: 2024-07-03T13:35:04-07:00
New Revision: a3c5c83273358a85a4e02f5f76379b1a276e7714

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

LOG: [DAGCombiner] Remove unneeded getValueType() calls in visitMULHS/MULHU. NFC

We have an existing VT variable that should match N0.getValueType.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 854e92369edd1..d81a54d2ecaaa 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5101,9 +5101,9 @@ SDValue DAGCombiner::visitMULHS(SDNode *N) {
 
   // fold (mulhs x, 1) -> (sra x, size(x)-1)
   if (isOneConstant(N1))
-    return DAG.getNode(ISD::SRA, DL, N0.getValueType(), N0,
+    return DAG.getNode(ISD::SRA, DL, VT, N0,
                        DAG.getConstant(N0.getScalarValueSizeInBits() - 1, DL,
-                                       getShiftAmountTy(N0.getValueType())));
+                                       getShiftAmountTy(VT)));
 
   // fold (mulhs x, undef) -> 0
   if (N0.isUndef() || N1.isUndef())
@@ -5161,7 +5161,7 @@ SDValue DAGCombiner::visitMULHU(SDNode *N) {
 
   // fold (mulhu x, 1) -> 0
   if (isOneConstant(N1))
-    return DAG.getConstant(0, DL, N0.getValueType());
+    return DAG.getConstant(0, DL, VT);
 
   // fold (mulhu x, undef) -> 0
   if (N0.isUndef() || N1.isUndef())


        


More information about the llvm-commits mailing list