diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index c70c3a27040..b40025b41f7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -771,10 +771,13 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,        // If the input sign bit is known to be zero, or if none of the top bits        // are demanded, turn this into an unsigned shift right. -      if (KnownZero.intersects(SignBit) || (HighBits & ~NewMask) == HighBits) -        return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT, -                                                 Op.getOperand(0), -                                                 Op.getOperand(1))); +      if (KnownZero.intersects(SignBit) || (HighBits & ~NewMask) == HighBits) { +        SDNodeFlags Flags; +        Flags.setExact(cast<BinaryWithFlagsSDNode>(Op)->Flags.hasExact()); +        return TLO.CombineTo(Op, +                             TLO.DAG.getNode(ISD::SRL, dl, VT, Op.getOperand(0), +                                             Op.getOperand(1), &Flags)); +      }        int Log2 = NewMask.exactLogBase2();        if (Log2 >= 0) { | 

