[llvm] 1dc2f25 - [SelectionDAG] ComputeKnownBits - assert we're computing the 0'th (difference) result for the SUB/SUBC cases

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 06:17:57 PST 2020


Author: Simon Pilgrim
Date: 2020-01-17T13:53:57Z
New Revision: 1dc2f257903d3fcb323425eefb5d9b57a0cbdd96

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

LOG: [SelectionDAG] ComputeKnownBits - assert we're computing the 0'th (difference) result for the SUB/SUBC cases

Matches what we already do for the ADD/ADDC/ADDE case.

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 1522075c67f8..e97fae08b6a6 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3141,6 +3141,9 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
     LLVM_FALLTHROUGH;
   case ISD::SUB:
   case ISD::SUBC: {
+    assert(Op.getResNo() == 0 &&
+           "We only compute knownbits for the 
diff erence here.");
+
     Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
     Known2 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
     Known = KnownBits::computeForAddSub(/* Add */ false, /* NSW */ false,


        


More information about the llvm-commits mailing list