forked from OSchip/llvm-project
[DAGCombiner] Don't create truncate nodes in (aext (zextload x)) -> (zextload x) and similar folds. NFCI
The truncate is being used to replace other users of of the load, but we checked that the load only has one use so there are no other uses to replace. llvm-svn: 324567
This commit is contained in:
parent
a217e505c3
commit
9b9d527427
|
@ -7592,10 +7592,7 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
|||
LN0->getBasePtr(), MemVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
N0.getValueType(), ExtLoad),
|
||||
ExtLoad.getValue(1));
|
||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN0, 1), ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
}
|
||||
}
|
||||
|
@ -7964,10 +7961,7 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
|||
LN0->getBasePtr(), MemVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0), N0.getValueType(),
|
||||
ExtLoad),
|
||||
ExtLoad.getValue(1));
|
||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN0, 1), ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
}
|
||||
}
|
||||
|
@ -8134,9 +8128,8 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
|||
// fold (aext (zextload x)) -> (aext (truncate (zextload x)))
|
||||
// fold (aext (sextload x)) -> (aext (truncate (sextload x)))
|
||||
// fold (aext ( extload x)) -> (aext (truncate (extload x)))
|
||||
if (N0.getOpcode() == ISD::LOAD &&
|
||||
!ISD::isNON_EXTLoad(N0.getNode()) && ISD::isUNINDEXEDLoad(N0.getNode()) &&
|
||||
N0.hasOneUse()) {
|
||||
if (N0.getOpcode() == ISD::LOAD && !ISD::isNON_EXTLoad(N0.getNode()) &&
|
||||
ISD::isUNINDEXEDLoad(N0.getNode()) && N0.hasOneUse()) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
ISD::LoadExtType ExtType = LN0->getExtensionType();
|
||||
EVT MemVT = LN0->getMemoryVT();
|
||||
|
@ -8145,10 +8138,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
|||
VT, LN0->getChain(), LN0->getBasePtr(),
|
||||
MemVT, LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
N0.getValueType(), ExtLoad),
|
||||
ExtLoad.getValue(1));
|
||||
DAG.ReplaceAllUsesOfValueWith(SDValue(LN0, 1), ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue