[llvm] r302262 - [KnownBits] Add wrapper methods for setting and clear all bits in the underlying APInts in KnownBits.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 18:10:18 PDT 2017


minor style comment: isUnknown seems a bit ambiguous when applied to a 
value which has many partially known states.  Maybe 
isCompletelyUnknown?  Or something along those lines?

Philip

On 05/05/2017 10:36 AM, Craig Topper via llvm-commits wrote:
> Author: ctopper
> Date: Fri May  5 12:36:09 2017
> New Revision: 302262
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302262&view=rev
> Log:
> [KnownBits] Add wrapper methods for setting and clear all bits in the underlying APInts in KnownBits.
>
> This adds routines for reseting KnownBits to unknown, making the value all zeros or all ones. It also adds methods for querying if the value is zero, all ones or unknown.
>
> Differential Revision: https://reviews.llvm.org/D32637
>
> Modified:
>      llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
>      llvm/trunk/include/llvm/Support/KnownBits.h
>      llvm/trunk/lib/Analysis/Lint.cpp
>      llvm/trunk/lib/Analysis/ValueTracking.cpp
>      llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>      llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
>      llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
>      llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
>      llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
>      llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
>      llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>      llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
>      llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
>      llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
>      llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/FunctionLoweringInfo.h Fri May  5 12:36:09 2017
> @@ -249,7 +249,7 @@ public:
>     void AddLiveOutRegInfo(unsigned Reg, unsigned NumSignBits,
>                            const KnownBits &Known) {
>       // Only install this information if it tells us something.
> -    if (NumSignBits == 1 && Known.Zero == 0 && Known.One == 0)
> +    if (NumSignBits == 1 && Known.isUnknown())
>         return;
>   
>       LiveOutRegInfo.grow(Reg);
>
> Modified: llvm/trunk/include/llvm/Support/KnownBits.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/KnownBits.h?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/KnownBits.h (original)
> +++ llvm/trunk/include/llvm/Support/KnownBits.h Fri May  5 12:36:09 2017
> @@ -59,6 +59,39 @@ public:
>       return One;
>     }
>   
> +  /// Returns true if we don't know any bits.
> +  bool isUnknown() const { return Zero.isNullValue() && One.isNullValue(); }
> +
> +  /// Resets the known state of all bits.
> +  void resetAll() {
> +    Zero.clearAllBits();
> +    One.clearAllBits();
> +  }
> +
> +  /// Returns true if value is all zero.
> +  bool isZero() const {
> +    assert(!hasConflict() && "KnownBits conflict!");
> +    return Zero.isAllOnesValue();
> +  }
> +
> +  /// Returns true if value is all one bits.
> +  bool isAllOnes() const {
> +    assert(!hasConflict() && "KnownBits conflict!");
> +    return One.isAllOnesValue();
> +  }
> +
> +  /// Make all bits known to be zero and discard any previous information.
> +  void setAllZero() {
> +    Zero.setAllBits();
> +    One.clearAllBits();
> +  }
> +
> +  /// Make all bits known to be one and discard any previous information.
> +  void setAllOnes() {
> +    Zero.clearAllBits();
> +    One.setAllBits();
> +  }
> +
>     /// Returns true if this value is known to be negative.
>     bool isNegative() const { return One.isSignBitSet(); }
>   
>
> Modified: llvm/trunk/lib/Analysis/Lint.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Lint.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/Lint.cpp (original)
> +++ llvm/trunk/lib/Analysis/Lint.cpp Fri May  5 12:36:09 2017
> @@ -537,7 +537,7 @@ static bool isZero(Value *V, const DataL
>       unsigned BitWidth = V->getType()->getIntegerBitWidth();
>       KnownBits Known(BitWidth);
>       computeKnownBits(V, Known, DL, 0, AC, dyn_cast<Instruction>(V), DT);
> -    return Known.Zero.isAllOnesValue();
> +    return Known.isZero();
>     }
>   
>     // Per-component check doesn't work with zeroinitializer
> @@ -558,7 +558,7 @@ static bool isZero(Value *V, const DataL
>   
>       KnownBits Known(BitWidth);
>       computeKnownBits(Elem, Known, DL);
> -    if (Known.Zero.isAllOnesValue())
> +    if (Known.isZero())
>         return true;
>     }
>   
>
> Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original)
> +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Fri May  5 12:36:09 2017
> @@ -342,7 +342,6 @@ static void computeKnownBitsMul(const Va
>     // 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.
> -  Known.One.clearAllBits();
>     unsigned TrailZ = Known.Zero.countTrailingOnes() +
>                       Known2.Zero.countTrailingOnes();
>     unsigned LeadZ =  std::max(Known.Zero.countLeadingOnes() +
> @@ -351,7 +350,7 @@ static void computeKnownBitsMul(const Va
>   
>     TrailZ = std::min(TrailZ, BitWidth);
>     LeadZ = std::min(LeadZ, BitWidth);
> -  Known.Zero.clearAllBits();
> +  Known.resetAll();
>     Known.Zero.setLowBits(TrailZ);
>     Known.Zero.setHighBits(LeadZ);
>   
> @@ -529,15 +528,13 @@ static void computeKnownBitsFromAssume(c
>   
>       if (Arg == V && isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
>         assert(BitWidth == 1 && "assume operand is not i1?");
> -      Known.Zero.clearAllBits();
> -      Known.One.setAllBits();
> +      Known.setAllOnes();
>         return;
>       }
>       if (match(Arg, m_Not(m_Specific(V))) &&
>           isValidAssumeForContext(I, Q.CxtI, Q.DT)) {
>         assert(BitWidth == 1 && "assume operand is not i1?");
> -      Known.Zero.setAllBits();
> -      Known.One.clearAllBits();
> +      Known.setAllZero();
>         return;
>       }
>   
> @@ -719,7 +716,7 @@ static void computeKnownBitsFromAssume(c
>         KnownBits RHSKnown(BitWidth);
>         computeKnownBits(A, RHSKnown, Depth+1, Query(Q, I));
>   
> -      if (RHSKnown.One.isAllOnesValue() || RHSKnown.isNonNegative()) {
> +      if (RHSKnown.isAllOnes() || RHSKnown.isNonNegative()) {
>           // We know that the sign bit is zero.
>           Known.makeNonNegative();
>         }
> @@ -741,7 +738,7 @@ static void computeKnownBitsFromAssume(c
>         KnownBits RHSKnown(BitWidth);
>         computeKnownBits(A, RHSKnown, Depth+1, Query(Q, I));
>   
> -      if (RHSKnown.Zero.isAllOnesValue() || RHSKnown.isNegative()) {
> +      if (RHSKnown.isZero() || RHSKnown.isNegative()) {
>           // We know that the sign bit is one.
>           Known.makeNegative();
>         }
> @@ -776,8 +773,7 @@ static void computeKnownBitsFromAssume(c
>     // behavior, or we might have a bug in the compiler. We can't assert/crash, so
>     // clear out the known bits, try to warn the user, and hope for the best.
>     if (Known.Zero.intersects(Known.One)) {
> -    Known.Zero.clearAllBits();
> -    Known.One.clearAllBits();
> +    Known.resetAll();
>   
>       if (Q.ORE) {
>         auto *CxtI = const_cast<Instruction *>(Q.CxtI);
> @@ -813,10 +809,8 @@ static void computeKnownBitsFromShiftOpe
>       // If there is conflict between Known.Zero and Known.One, this must be an
>       // overflowing left shift, so the shift result is undefined. Clear Known
>       // bits so that other code could propagate this undef.
> -    if ((Known.Zero & Known.One) != 0) {
> -      Known.Zero.clearAllBits();
> -      Known.One.clearAllBits();
> -    }
> +    if ((Known.Zero & Known.One) != 0)
> +      Known.resetAll();
>   
>       return;
>     }
> @@ -826,8 +820,7 @@ static void computeKnownBitsFromShiftOpe
>     // If the shift amount could be greater than or equal to the bit-width of the LHS, the
>     // value could be undef, so we don't know anything about it.
>     if ((~Known.Zero).uge(BitWidth)) {
> -    Known.Zero.clearAllBits();
> -    Known.One.clearAllBits();
> +    Known.resetAll();
>       return;
>     }
>   
> @@ -839,8 +832,7 @@ static void computeKnownBitsFromShiftOpe
>   
>     // It would be more-clearly correct to use the two temporaries for this
>     // calculation. Reusing the APInts here to prevent unnecessary allocations.
> -  Known.Zero.clearAllBits();
> -  Known.One.clearAllBits();
> +  Known.resetAll();
>   
>     // If we know the shifter operand is nonzero, we can sometimes infer more
>     // known bits. However this is expensive to compute, so be lazy about it and
> @@ -886,10 +878,8 @@ static void computeKnownBitsFromShiftOpe
>     // return anything we'd like, but we need to make sure the sets of known bits
>     // stay disjoint (it should be better for some other code to actually
>     // propagate the undef than to pick a value here using known bits).
> -  if (Known.Zero.intersects(Known.One)) {
> -    Known.Zero.clearAllBits();
> -    Known.One.clearAllBits();
> -  }
> +  if (Known.Zero.intersects(Known.One))
> +    Known.resetAll();
>   }
>   
>   static void computeKnownBitsFromOperator(const Operator *I, KnownBits &Known,
> @@ -924,7 +914,7 @@ static void computeKnownBitsFromOperator
>                                          m_Value(Y))) ||
>            match(I->getOperand(1), m_Add(m_Specific(I->getOperand(0)),
>                                          m_Value(Y))))) {
> -      Known2.Zero.clearAllBits(); Known2.One.clearAllBits();
> +      Known2.resetAll();
>         computeKnownBits(Y, Known2, Depth + 1, Q);
>         if (Known2.One.countTrailingOnes() > 0)
>           Known.Zero.setBit(0);
> @@ -965,8 +955,7 @@ static void computeKnownBitsFromOperator
>       computeKnownBits(I->getOperand(0), Known2, Depth + 1, Q);
>       unsigned LeadZ = Known2.Zero.countLeadingOnes();
>   
> -    Known2.One.clearAllBits();
> -    Known2.Zero.clearAllBits();
> +    Known2.resetAll();
>       computeKnownBits(I->getOperand(1), Known2, Depth + 1, Q);
>       unsigned RHSUnknownLeadingOnes = Known2.One.countLeadingZeros();
>       if (RHSUnknownLeadingOnes != BitWidth)
> @@ -1198,8 +1187,7 @@ static void computeKnownBitsFromOperator
>   
>       unsigned Leaders = std::max(Known.Zero.countLeadingOnes(),
>                                   Known2.Zero.countLeadingOnes());
> -    Known.One.clearAllBits();
> -    Known.Zero.clearAllBits();
> +    Known.resetAll();
>       Known.Zero.setHighBits(Leaders);
>       break;
>     }
> @@ -1500,8 +1488,7 @@ void computeKnownBits(const Value *V, Kn
>     }
>     // Null and aggregate-zero are all-zeros.
>     if (isa<ConstantPointerNull>(V) || isa<ConstantAggregateZero>(V)) {
> -    Known.One.clearAllBits();
> -    Known.Zero.setAllBits();
> +    Known.setAllZero();
>       return;
>     }
>     // Handle a constant vector by taking the intersection of the known bits of
> @@ -1528,8 +1515,7 @@ void computeKnownBits(const Value *V, Kn
>         Constant *Element = CV->getAggregateElement(i);
>         auto *ElementCI = dyn_cast_or_null<ConstantInt>(Element);
>         if (!ElementCI) {
> -        Known.Zero.clearAllBits();
> -        Known.One.clearAllBits();
> +        Known.resetAll();
>           return;
>         }
>         Elt = ElementCI->getValue();
> @@ -1540,7 +1526,7 @@ void computeKnownBits(const Value *V, Kn
>     }
>   
>     // Start out not knowing anything.
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>   
>     // We can't imply anything about undefs.
>     if (isa<UndefValue>(V))
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri May  5 12:36:09 2017
> @@ -2044,8 +2044,7 @@ void SelectionDAG::computeKnownBits(SDVa
>         if (M < 0) {
>           // For UNDEF elements, we don't know anything about the common state of
>           // the shuffle result.
> -        Known.One.clearAllBits();
> -        Known.Zero.clearAllBits();
> +        Known.resetAll();
>           DemandedLHS.clearAllBits();
>           DemandedRHS.clearAllBits();
>           break;
> @@ -2218,14 +2217,13 @@ void SelectionDAG::computeKnownBits(SDVa
>       // 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.
> -    Known.One.clearAllBits();
>       unsigned TrailZ = Known.Zero.countTrailingOnes() +
>                         Known2.Zero.countTrailingOnes();
>       unsigned LeadZ =  std::max(Known.Zero.countLeadingOnes() +
>                                  Known2.Zero.countLeadingOnes(),
>                                  BitWidth) - BitWidth;
>   
> -    Known.Zero.clearAllBits();
> +    Known.resetAll();
>       Known.Zero.setLowBits(std::min(TrailZ, BitWidth));
>       Known.Zero.setHighBits(std::min(LeadZ, BitWidth));
>       break;
> @@ -2598,8 +2596,7 @@ void SelectionDAG::computeKnownBits(SDVa
>   
>       uint32_t Leaders = std::max(Known.Zero.countLeadingOnes(),
>                                   Known2.Zero.countLeadingOnes());
> -    Known.One.clearAllBits();
> -    Known.Zero.clearAllBits();
> +    Known.resetAll();
>       Known.Zero.setHighBits(Leaders);
>       break;
>     }
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri May  5 12:36:09 2017
> @@ -1303,7 +1303,7 @@ void TargetLowering::computeKnownBitsFor
>             Op.getOpcode() == ISD::INTRINSIC_VOID) &&
>            "Should use MaskedValueIsZero if you don't know whether Op"
>            " is a target node!");
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>   }
>   
>   /// This method can be implemented by targets that want to expose additional
>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -3580,7 +3580,7 @@ void AMDGPUTargetLowering::computeKnownB
>       const SDValue Op, KnownBits &Known,
>       const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const {
>   
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits(); // Don't know anything.
> +  Known.resetAll(); // Don't know anything.
>   
>     KnownBits Known2;
>     unsigned Opc = Op.getOpcode();
>
> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -12640,7 +12640,7 @@ void ARMTargetLowering::computeKnownBits
>                                                         const SelectionDAG &DAG,
>                                                         unsigned Depth) const {
>     unsigned BitWidth = Known.getBitWidth();
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>     switch (Op.getOpcode()) {
>     default: break;
>     case ARMISD::ADDC:
> @@ -12655,7 +12655,8 @@ void ARMTargetLowering::computeKnownBits
>     case ARMISD::CMOV: {
>       // Bits are known zero/one if known on the LHS and RHS.
>       DAG.computeKnownBits(Op.getOperand(0), Known, Depth+1);
> -    if (Known.Zero == 0 && Known.One == 0) return;
> +    if (Known.isUnknown())
> +      return;
>   
>       KnownBits KnownRHS;
>       DAG.computeKnownBits(Op.getOperand(1), KnownRHS, Depth+1);
>
> Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -12031,7 +12031,7 @@ void PPCTargetLowering::computeKnownBits
>                                                         const APInt &DemandedElts,
>                                                         const SelectionDAG &DAG,
>                                                         unsigned Depth) const {
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>     switch (Op.getOpcode()) {
>     default: break;
>     case PPCISD::LBRX: {
>
> Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -1881,7 +1881,7 @@ void SparcTargetLowering::computeKnownBi
>                                    const SelectionDAG &DAG,
>                                    unsigned Depth) const {
>     KnownBits Known2;
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>   
>     switch (Op.getOpcode()) {
>     default: break;
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -26614,7 +26614,7 @@ void X86TargetLowering::computeKnownBits
>            "Should use MaskedValueIsZero if you don't know whether Op"
>            " is a target node!");
>   
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>     switch (Opc) {
>     default: break;
>     case X86ISD::ADD:
> @@ -26644,7 +26644,7 @@ void X86TargetLowering::computeKnownBits
>     case X86ISD::VSRLI: {
>       if (auto *ShiftImm = dyn_cast<ConstantSDNode>(Op.getOperand(1))) {
>         if (ShiftImm->getAPIntValue().uge(VT.getScalarSizeInBits())) {
> -        Known.Zero.setAllBits();
> +        Known.setAllZero();
>           break;
>         }
>   
>
> Modified: llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp (original)
> +++ llvm/trunk/lib/Target/XCore/XCoreISelLowering.cpp Fri May  5 12:36:09 2017
> @@ -1825,7 +1825,7 @@ void XCoreTargetLowering::computeKnownBi
>                                                           const APInt &DemandedElts,
>                                                           const SelectionDAG &DAG,
>                                                           unsigned Depth) const {
> -  Known.Zero.clearAllBits(); Known.One.clearAllBits();
> +  Known.resetAll();
>     switch (Op.getOpcode()) {
>     default: break;
>     case XCoreISD::LADD:
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri May  5 12:36:09 2017
> @@ -3619,7 +3619,7 @@ Instruction *InstCombiner::visitCallInst
>       // then this one is redundant, and should be removed.
>       KnownBits Known(1);
>       computeKnownBits(IIOperand, Known, 0, II);
> -    if (Known.One.isAllOnesValue())
> +    if (Known.isAllOnes())
>         return eraseInstFromFunction(*II);
>   
>       // Update the cache of affected values for this assumption (we might be
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri May  5 12:36:09 2017
> @@ -4050,7 +4050,7 @@ Instruction *InstCombiner::foldICmpUsing
>       // is set. If the comparison is against zero, then this is a check to see if
>       // *that* bit is set.
>       APInt Op0KnownZeroInverted = ~Op0Known.Zero;
> -    if (~Op1Known.Zero == 0) {
> +    if (Op1Known.isZero()) {
>         // If the LHS is an AND with the same constant, look through it.
>         Value *LHS = nullptr;
>         const APInt *LHSC;
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=302262&r1=302261&r2=302262&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Fri May  5 12:36:09 2017
> @@ -120,8 +120,7 @@ Value *InstCombiner::SimplifyDemandedUse
>       return nullptr;
>     }
>   
> -  Known.Zero.clearAllBits();
> -  Known.One.clearAllBits();
> +  Known.resetAll();
>     if (DemandedMask == 0)     // Not demanding any bits from V.
>       return UndefValue::get(VTy);
>   
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list