mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Fix the remaining DAGCombiner issues pointed out by sabre. This should fix
the remainder of the failures introduced by my patch last night. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
67a44cd3aa
commit
bfd65a05c9
@ -801,10 +801,9 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
|
|||||||
// fold (zext_inreg (extload x)) -> (zextload x)
|
// fold (zext_inreg (extload x)) -> (zextload x)
|
||||||
if (N1C && N0.getOpcode() == ISD::EXTLOAD) {
|
if (N1C && N0.getOpcode() == ISD::EXTLOAD) {
|
||||||
MVT::ValueType EVT = cast<VTSDNode>(N0.getOperand(3))->getVT();
|
MVT::ValueType EVT = cast<VTSDNode>(N0.getOperand(3))->getVT();
|
||||||
// If the type of the zext_inreg and the extload match, and we're running
|
// If we zero all the possible extended bits, then we can turn this into
|
||||||
// before Legalize, or the resulting zextload is legal on the target, then
|
// a zextload if we are running before legalize or the operation is legal.
|
||||||
// go ahead and do the fold.
|
if (MaskedValueIsZero(SDOperand(N,0), ~0ULL<<MVT::getSizeInBits(EVT),TLI) &&
|
||||||
if ((N1C->getValue() == (1ULL << MVT::getSizeInBits(EVT))-1) &&
|
|
||||||
(!AfterLegalize || TLI.isOperationLegal(ISD::ZEXTLOAD, EVT))) {
|
(!AfterLegalize || TLI.isOperationLegal(ISD::ZEXTLOAD, EVT))) {
|
||||||
SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getOperand(0),
|
SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getOperand(0),
|
||||||
N0.getOperand(1), N0.getOperand(2),
|
N0.getOperand(1), N0.getOperand(2),
|
||||||
@ -817,12 +816,10 @@ SDOperand DAGCombiner::visitAND(SDNode *N) {
|
|||||||
// fold (zext_inreg (sextload x)) -> (zextload x) iff load has one use
|
// fold (zext_inreg (sextload x)) -> (zextload x) iff load has one use
|
||||||
if (N1C && N0.getOpcode() == ISD::SEXTLOAD && N0.Val->hasNUsesOfValue(1, 0)) {
|
if (N1C && N0.getOpcode() == ISD::SEXTLOAD && N0.Val->hasNUsesOfValue(1, 0)) {
|
||||||
MVT::ValueType EVT = cast<VTSDNode>(N0.getOperand(3))->getVT();
|
MVT::ValueType EVT = cast<VTSDNode>(N0.getOperand(3))->getVT();
|
||||||
// If the type of the zext_inreg and the extload match, and we're running
|
// If we zero all the possible extended bits, then we can turn this into
|
||||||
// before Legalize, or the resulting zextload is legal on the target, then
|
// a zextload if we are running before legalize or the operation is legal.
|
||||||
// go ahead and do the fold.
|
if (MaskedValueIsZero(SDOperand(N,0), ~0ULL<<MVT::getSizeInBits(EVT),TLI) &&
|
||||||
if ((N1C->getValue() == (1ULL << MVT::getSizeInBits(EVT))-1) &&
|
(!AfterLegalize || TLI.isOperationLegal(ISD::ZEXTLOAD, EVT))) {
|
||||||
(!AfterLegalize ||
|
|
||||||
TargetLowering::Legal == TLI.getOperationAction(ISD::ZEXTLOAD, EVT))) {
|
|
||||||
SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getOperand(0),
|
SDOperand ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, VT, N0.getOperand(0),
|
||||||
N0.getOperand(1), N0.getOperand(2),
|
N0.getOperand(1), N0.getOperand(2),
|
||||||
EVT);
|
EVT);
|
||||||
@ -1324,25 +1321,23 @@ SDOperand DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
|
|||||||
// fold (sext_inreg (extload x)) -> (sextload x)
|
// fold (sext_inreg (extload x)) -> (sextload x)
|
||||||
if (N0.getOpcode() == ISD::EXTLOAD &&
|
if (N0.getOpcode() == ISD::EXTLOAD &&
|
||||||
EVT == cast<VTSDNode>(N0.getOperand(3))->getVT() &&
|
EVT == cast<VTSDNode>(N0.getOperand(3))->getVT() &&
|
||||||
(!AfterLegalize ||
|
(!AfterLegalize || TLI.isOperationLegal(ISD::SEXTLOAD, EVT))) {
|
||||||
(TargetLowering::Legal == TLI.getOperationAction(ISD::SEXTLOAD, EVT)))) {
|
|
||||||
SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N0.getOperand(0),
|
SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N0.getOperand(0),
|
||||||
N0.getOperand(1), N0.getOperand(2),
|
N0.getOperand(1), N0.getOperand(2),
|
||||||
EVT);
|
EVT);
|
||||||
CombineTo(N0.Val, ExtLoad, ExtLoad.getOperand(0));
|
|
||||||
WorkList.push_back(N);
|
WorkList.push_back(N);
|
||||||
|
CombineTo(N0.Val, ExtLoad, ExtLoad.getValue(1));
|
||||||
return SDOperand();
|
return SDOperand();
|
||||||
}
|
}
|
||||||
// fold (sext_inreg (zextload x)) -> (sextload x) iff load has one use
|
// fold (sext_inreg (zextload x)) -> (sextload x) iff load has one use
|
||||||
if (N0.getOpcode() == ISD::ZEXTLOAD && N0.Val->hasNUsesOfValue(1, 0) &&
|
if (N0.getOpcode() == ISD::ZEXTLOAD && N0.Val->hasNUsesOfValue(1, 0) &&
|
||||||
EVT == cast<VTSDNode>(N0.getOperand(3))->getVT() &&
|
EVT == cast<VTSDNode>(N0.getOperand(3))->getVT() &&
|
||||||
(!AfterLegalize ||
|
(!AfterLegalize || TLI.isOperationLegal(ISD::SEXTLOAD, EVT))) {
|
||||||
(TargetLowering::Legal == TLI.getOperationAction(ISD::SEXTLOAD, EVT)))) {
|
|
||||||
SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N0.getOperand(0),
|
SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, N0.getOperand(0),
|
||||||
N0.getOperand(1), N0.getOperand(2),
|
N0.getOperand(1), N0.getOperand(2),
|
||||||
EVT);
|
EVT);
|
||||||
CombineTo(N0.Val, ExtLoad, ExtLoad.getOperand(0));
|
|
||||||
WorkList.push_back(N);
|
WorkList.push_back(N);
|
||||||
|
CombineTo(N0.Val, ExtLoad, ExtLoad.getValue(1));
|
||||||
return SDOperand();
|
return SDOperand();
|
||||||
}
|
}
|
||||||
return SDOperand();
|
return SDOperand();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user