[llvm] 825e517 - [DAG] computeKnownBits - Replace ISD::MUL handling with the common KnownBits::computeForMul implementation

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 03:35:39 PST 2020


Author: Simon Pilgrim
Date: 2020-11-04T11:32:08Z
New Revision: 825e517e340a2218e375e315fa9941f9ac9e6439

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

LOG: [DAG] computeKnownBits - Replace ISD::MUL handling with the common KnownBits::computeForMul implementation

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 89ded9eb3ebb..8a2f1eaf9ce2 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2879,20 +2879,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
   case ISD::MUL: {
     Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
     Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
-
-    // If low bits are zero in either operand, output low known-0 bits.
-    // Also compute a conservative estimate for high known-0 bits.
-    // More trickiness is possible, but this is sufficient for the
-    // interesting case of alignment computation.
-    unsigned TrailZ = Known.countMinTrailingZeros() +
-                      Known2.countMinTrailingZeros();
-    unsigned LeadZ =  std::max(Known.countMinLeadingZeros() +
-                               Known2.countMinLeadingZeros(),
-                               BitWidth) - BitWidth;
-
-    Known.resetAll();
-    Known.Zero.setLowBits(std::min(TrailZ, BitWidth));
-    Known.Zero.setHighBits(std::min(LeadZ, BitWidth));
+    Known = KnownBits::computeForMul(Known, Known2);
     break;
   }
   case ISD::UDIV: {


        


More information about the llvm-commits mailing list