mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
Bug 19348: Check for legal ExtLoad operation before folding
(aext (zextload x)) -> (aext (truncate (*extload x))) Patch by Stanislav Mekhanoshin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205805 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a83f78786e
commit
1507319299
@ -5507,16 +5507,19 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
||||
!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();
|
||||
SDValue ExtLoad = DAG.getExtLoad(LN0->getExtensionType(), SDLoc(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));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
if (!LegalOperations || TLI.isLoadExtLegal(ExtType, MemVT)) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ExtType, SDLoc(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));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
}
|
||||
}
|
||||
|
||||
if (N0.getOpcode() == ISD::SETCC) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user