mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
[DAGCombiner] Preserve the exact bit when simplifying SRA to SRL.
Allows more aggressive folding of ashr/shl pairs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240788 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user