Revert r191049/r191059 as it can produce wrong code (see PR17975).

It has already been reverted on the 3.4 branch in r196521.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206311 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Robert Lougher
2014-04-15 18:34:24 +00:00
parent 2bbc5a7e2c
commit 4634a9ba1e
3 changed files with 4 additions and 97 deletions

View File

@@ -3555,27 +3555,6 @@ SDNode *DAGCombiner::MatchRotatePosNeg(SDValue Shifted, SDValue Pos,
HasPos ? Pos : Neg).getNode();
}
// fold (or (shl (*ext x), (*ext y)),
// (srl (*ext x), (*ext (sub 32, y)))) ->
// (*ext (rotl x, y)) or (*ext (rotr x, (sub 32, y)))
//
// fold (or (shl (*ext x), (*ext (sub 32, y))),
// (srl (*ext x), (*ext y))) ->
// (*ext (rotr x, y)) or (*ext (rotl x, (sub 32, y)))
if (Shifted.getOpcode() == ISD::ZERO_EXTEND ||
Shifted.getOpcode() == ISD::ANY_EXTEND) {
SDValue InnerShifted = Shifted.getOperand(0);
EVT InnerVT = InnerShifted.getValueType();
bool HasPosInner = TLI.isOperationLegalOrCustom(PosOpcode, InnerVT);
if (HasPosInner || TLI.isOperationLegalOrCustom(NegOpcode, InnerVT)) {
if (matchRotateSub(InnerPos, InnerNeg, InnerVT.getSizeInBits())) {
SDValue V = DAG.getNode(HasPosInner ? PosOpcode : NegOpcode, DL,
InnerVT, InnerShifted, HasPosInner ? Pos : Neg);
return DAG.getNode(Shifted.getOpcode(), DL, VT, V).getNode();
}
}
}
return nullptr;
}