mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Keep TBAA info when rewriting SelectionDAG loads and stores
Most SelectionDAG code drops the TBAA info when creating a new form of a load and store (e.g. during legalization, or when converting a plain load to an extending one). This patch tries to catch all cases where the TBAA information can legitimately be carried over. The patch adds alternative forms of getLoad() and getExtLoad() that take a MachineMemOperand instead of individual fields. (The corresponding getTruncStore() already exists.) The idea is to use the MachineMemOperand forms when all fields are carried over (size, pointer info, isVolatile, isNonTemporal, alignment and TBAA info). If some adjustment is being made, e.g. to narrow the load, then we still pass the individual fields but also pass the TBAA info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
188545867d
commit
66589dcc8f
@ -754,11 +754,16 @@ public:
|
||||
MachinePointerInfo PtrInfo, bool isVolatile,
|
||||
bool isNonTemporal, bool isInvariant, unsigned Alignment,
|
||||
const MDNode *TBAAInfo = 0, const MDNode *Ranges = 0);
|
||||
SDValue getLoad(EVT VT, SDLoc dl, SDValue Chain, SDValue Ptr,
|
||||
MachineMemOperand *MMO);
|
||||
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
||||
SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo,
|
||||
EVT MemVT, bool isVolatile,
|
||||
bool isNonTemporal, unsigned Alignment,
|
||||
const MDNode *TBAAInfo = 0);
|
||||
SDValue getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
||||
SDValue Chain, SDValue Ptr, EVT MemVT,
|
||||
MachineMemOperand *MMO);
|
||||
SDValue getIndexedLoad(SDValue OrigLoad, SDLoc dl, SDValue Base,
|
||||
SDValue Offset, ISD::MemIndexedMode AM);
|
||||
SDValue getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
|
||||
|
@ -765,9 +765,7 @@ SDValue DAGCombiner::PromoteOperand(SDValue Op, EVT PVT, bool &Replace) {
|
||||
Replace = true;
|
||||
return DAG.getExtLoad(ExtType, dl, PVT,
|
||||
LD->getChain(), LD->getBasePtr(),
|
||||
LD->getPointerInfo(),
|
||||
MemVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), LD->getAlignment());
|
||||
MemVT, LD->getMemOperand());
|
||||
}
|
||||
|
||||
unsigned Opc = Op.getOpcode();
|
||||
@ -988,9 +986,7 @@ bool DAGCombiner::PromoteLoad(SDValue Op) {
|
||||
: LD->getExtensionType();
|
||||
SDValue NewLD = DAG.getExtLoad(ExtType, dl, PVT,
|
||||
LD->getChain(), LD->getBasePtr(),
|
||||
LD->getPointerInfo(),
|
||||
MemVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), LD->getAlignment());
|
||||
MemVT, LD->getMemOperand());
|
||||
SDValue Result = DAG.getNode(ISD::TRUNCATE, dl, VT, NewLD);
|
||||
|
||||
DEBUG(dbgs() << "\nPromoting ";
|
||||
@ -2759,9 +2755,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
|
||||
TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(N0), VT,
|
||||
LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getPointerInfo(), MemVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
MemVT, LN0->getMemOperand());
|
||||
AddToWorkList(N);
|
||||
CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
@ -2780,11 +2774,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
|
||||
((!LegalOperations && !LN0->isVolatile()) ||
|
||||
TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT))) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(N0), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
MemVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getChain(), LN0->getBasePtr(),
|
||||
MemVT, LN0->getMemOperand());
|
||||
AddToWorkList(N);
|
||||
CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
@ -2814,10 +2805,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
|
||||
|
||||
SDValue NewLoad =
|
||||
DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(LN0), LoadResultTy,
|
||||
LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getPointerInfo(),
|
||||
ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getChain(), LN0->getBasePtr(), ExtVT,
|
||||
LN0->getMemOperand());
|
||||
AddToWorkList(N);
|
||||
CombineTo(LN0, NewLoad, NewLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
@ -2853,7 +2842,7 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
|
||||
LN0->getChain(), NewPtr,
|
||||
LN0->getPointerInfo(),
|
||||
ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
Alignment);
|
||||
Alignment, LN0->getTBAAInfo());
|
||||
AddToWorkList(N);
|
||||
CombineTo(LN0, Load, Load.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
@ -4572,10 +4561,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
N0.getValueType(),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), N0.getValueType(),
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
SDValue Trunc = DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
N0.getValueType(), ExtLoad);
|
||||
@ -4596,10 +4583,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
||||
TLI.isLoadExtLegal(ISD::SEXTLOAD, MemVT)) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
MemVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), MemVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
@ -4627,11 +4612,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
|
||||
if (DoXform) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, SDLoc(LN0), VT,
|
||||
LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getPointerInfo(),
|
||||
LN0->getMemoryVT(),
|
||||
LN0->isVolatile(),
|
||||
LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getMemOperand());
|
||||
APInt Mask = cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
|
||||
Mask = Mask.sext(VT.getSizeInBits());
|
||||
SDValue And = DAG.getNode(N0.getOpcode(), SDLoc(N), VT,
|
||||
@ -4865,10 +4847,8 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
N0.getValueType(),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), N0.getValueType(),
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
SDValue Trunc = DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
N0.getValueType(), ExtLoad);
|
||||
@ -4898,11 +4878,8 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
||||
if (DoXform) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(LN0), VT,
|
||||
LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getPointerInfo(),
|
||||
LN0->getMemoryVT(),
|
||||
LN0->isVolatile(),
|
||||
LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getMemOperand());
|
||||
APInt Mask = cast<ConstantSDNode>(N0.getOperand(1))->getAPIntValue();
|
||||
Mask = Mask.zext(VT.getSizeInBits());
|
||||
SDValue And = DAG.getNode(N0.getOpcode(), SDLoc(N), VT,
|
||||
@ -4929,10 +4906,8 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
|
||||
TLI.isLoadExtLegal(ISD::ZEXTLOAD, MemVT)) {
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
MemVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), MemVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0), N0.getValueType(),
|
||||
@ -5095,10 +5070,8 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
N0.getValueType(),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), N0.getValueType(),
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
SDValue Trunc = DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
N0.getValueType(), ExtLoad);
|
||||
@ -5119,9 +5092,7 @@ SDValue DAGCombiner::visitANY_EXTEND(SDNode *N) {
|
||||
EVT MemVT = LN0->getMemoryVT();
|
||||
SDValue ExtLoad = DAG.getExtLoad(LN0->getExtensionType(), SDLoc(N),
|
||||
VT, LN0->getChain(), LN0->getBasePtr(),
|
||||
LN0->getPointerInfo(), MemVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
MemVT, LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::TRUNCATE, SDLoc(N0),
|
||||
@ -5353,12 +5324,12 @@ SDValue DAGCombiner::ReduceLoadWidth(SDNode *N) {
|
||||
Load = DAG.getLoad(VT, SDLoc(N0), LN0->getChain(), NewPtr,
|
||||
LN0->getPointerInfo().getWithOffset(PtrOff),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->isInvariant(), NewAlign);
|
||||
LN0->isInvariant(), NewAlign, LN0->getTBAAInfo());
|
||||
else
|
||||
Load = DAG.getExtLoad(ExtType, SDLoc(N0), VT, LN0->getChain(),NewPtr,
|
||||
LN0->getPointerInfo().getWithOffset(PtrOff),
|
||||
ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
NewAlign);
|
||||
NewAlign, LN0->getTBAAInfo());
|
||||
|
||||
// Replace the old load's chain with the new load's chain.
|
||||
WorkListRemover DeadNodes(*this);
|
||||
@ -5456,10 +5427,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
EVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), EVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
|
||||
AddToWorkList(ExtLoad.getNode());
|
||||
@ -5474,10 +5443,8 @@ SDValue DAGCombiner::visitSIGN_EXTEND_INREG(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
EVT,
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), EVT,
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(), ExtLoad, ExtLoad.getValue(1));
|
||||
return SDValue(N, 0); // Return N so it doesn't get rechecked!
|
||||
@ -5770,7 +5737,8 @@ SDValue DAGCombiner::visitBITCAST(SDNode *N) {
|
||||
SDValue Load = DAG.getLoad(VT, SDLoc(N), LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->isInvariant(), OrigAlign);
|
||||
LN0->isInvariant(), OrigAlign,
|
||||
LN0->getTBAAInfo());
|
||||
AddToWorkList(N);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::BITCAST, SDLoc(N0),
|
||||
@ -6761,10 +6729,8 @@ SDValue DAGCombiner::visitFP_EXTEND(SDNode *N) {
|
||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||
SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, SDLoc(N), VT,
|
||||
LN0->getChain(),
|
||||
LN0->getBasePtr(), LN0->getPointerInfo(),
|
||||
N0.getValueType(),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->getAlignment());
|
||||
LN0->getBasePtr(), N0.getValueType(),
|
||||
LN0->getMemOperand());
|
||||
CombineTo(N, ExtLoad);
|
||||
CombineTo(N0.getNode(),
|
||||
DAG.getNode(ISD::FP_ROUND, SDLoc(N0),
|
||||
@ -7554,7 +7520,8 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
|
||||
LD->getValueType(0),
|
||||
Chain, Ptr, LD->getPointerInfo(),
|
||||
LD->getMemoryVT(),
|
||||
LD->isVolatile(), LD->isNonTemporal(), Align);
|
||||
LD->isVolatile(), LD->isNonTemporal(), Align,
|
||||
LD->getTBAAInfo());
|
||||
return CombineTo(N, NewLoad, SDValue(NewLoad.getNode(), 1), true);
|
||||
}
|
||||
}
|
||||
@ -7573,17 +7540,12 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
|
||||
// Replace the chain to void dependency.
|
||||
if (LD->getExtensionType() == ISD::NON_EXTLOAD) {
|
||||
ReplLoad = DAG.getLoad(N->getValueType(0), SDLoc(LD),
|
||||
BetterChain, Ptr, LD->getPointerInfo(),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(), LD->getAlignment());
|
||||
BetterChain, Ptr, LD->getMemOperand());
|
||||
} else {
|
||||
ReplLoad = DAG.getExtLoad(LD->getExtensionType(), SDLoc(LD),
|
||||
LD->getValueType(0),
|
||||
BetterChain, Ptr, LD->getPointerInfo(),
|
||||
LD->getMemoryVT(),
|
||||
LD->isVolatile(),
|
||||
LD->isNonTemporal(),
|
||||
LD->getAlignment());
|
||||
BetterChain, Ptr, LD->getMemoryVT(),
|
||||
LD->getMemOperand());
|
||||
}
|
||||
|
||||
// Create token factor to keep old chain connected.
|
||||
@ -8393,7 +8355,8 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
|
||||
LD->getChain(), NewPtr,
|
||||
LD->getPointerInfo().getWithOffset(PtrOff),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(), NewAlign);
|
||||
LD->isInvariant(), NewAlign,
|
||||
LD->getTBAAInfo());
|
||||
SDValue NewVal = DAG.getNode(Opc, SDLoc(Value), NewVT, NewLD,
|
||||
DAG.getConstant(NewImm, NewVT));
|
||||
SDValue NewST = DAG.getStore(Chain, SDLoc(N),
|
||||
@ -9053,7 +9016,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
TLI.isOperationLegalOrCustom(ISD::STORE, SVT)))
|
||||
return DAG.getStore(Chain, SDLoc(N), Value.getOperand(0),
|
||||
Ptr, ST->getPointerInfo(), ST->isVolatile(),
|
||||
ST->isNonTemporal(), OrigAlign);
|
||||
ST->isNonTemporal(), OrigAlign,
|
||||
ST->getTBAAInfo());
|
||||
}
|
||||
|
||||
// Turn 'store undef, Ptr' -> nothing.
|
||||
@ -9081,8 +9045,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
Tmp = DAG.getConstant((uint32_t)CFP->getValueAPF().
|
||||
bitcastToAPInt().getZExtValue(), MVT::i32);
|
||||
return DAG.getStore(Chain, SDLoc(N), Tmp,
|
||||
Ptr, ST->getPointerInfo(), ST->isVolatile(),
|
||||
ST->isNonTemporal(), ST->getAlignment());
|
||||
Ptr, ST->getMemOperand());
|
||||
}
|
||||
break;
|
||||
case MVT::f64:
|
||||
@ -9092,8 +9055,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
Tmp = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
|
||||
getZExtValue(), MVT::i64);
|
||||
return DAG.getStore(Chain, SDLoc(N), Tmp,
|
||||
Ptr, ST->getPointerInfo(), ST->isVolatile(),
|
||||
ST->isNonTemporal(), ST->getAlignment());
|
||||
Ptr, ST->getMemOperand());
|
||||
}
|
||||
|
||||
if (!ST->isVolatile() &&
|
||||
@ -9109,18 +9071,19 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
unsigned Alignment = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
|
||||
SDValue St0 = DAG.getStore(Chain, SDLoc(ST), Lo,
|
||||
Ptr, ST->getPointerInfo(),
|
||||
isVolatile, isNonTemporal,
|
||||
ST->getAlignment());
|
||||
ST->getAlignment(), TBAAInfo);
|
||||
Ptr = DAG.getNode(ISD::ADD, SDLoc(N), Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(4, Ptr.getValueType()));
|
||||
Alignment = MinAlign(Alignment, 4U);
|
||||
SDValue St1 = DAG.getStore(Chain, SDLoc(ST), Hi,
|
||||
Ptr, ST->getPointerInfo().getWithOffset(4),
|
||||
isVolatile, isNonTemporal,
|
||||
Alignment);
|
||||
Alignment, TBAAInfo);
|
||||
return DAG.getNode(ISD::TokenFactor, SDLoc(N), MVT::Other,
|
||||
St0, St1);
|
||||
}
|
||||
@ -9136,7 +9099,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
if (Align > ST->getAlignment())
|
||||
return DAG.getTruncStore(Chain, SDLoc(N), Value,
|
||||
Ptr, ST->getPointerInfo(), ST->getMemoryVT(),
|
||||
ST->isVolatile(), ST->isNonTemporal(), Align);
|
||||
ST->isVolatile(), ST->isNonTemporal(), Align,
|
||||
ST->getTBAAInfo());
|
||||
}
|
||||
}
|
||||
|
||||
@ -9159,14 +9123,10 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
// Replace the chain to avoid dependency.
|
||||
if (ST->isTruncatingStore()) {
|
||||
ReplStore = DAG.getTruncStore(BetterChain, SDLoc(N), Value, Ptr,
|
||||
ST->getPointerInfo(),
|
||||
ST->getMemoryVT(), ST->isVolatile(),
|
||||
ST->isNonTemporal(), ST->getAlignment());
|
||||
ST->getMemoryVT(), ST->getMemOperand());
|
||||
} else {
|
||||
ReplStore = DAG.getStore(BetterChain, SDLoc(N), Value, Ptr,
|
||||
ST->getPointerInfo(),
|
||||
ST->isVolatile(), ST->isNonTemporal(),
|
||||
ST->getAlignment());
|
||||
ST->getMemOperand());
|
||||
}
|
||||
|
||||
// Create token to keep both nodes around.
|
||||
@ -9199,9 +9159,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
AddToWorkList(Value.getNode());
|
||||
if (Shorter.getNode())
|
||||
return DAG.getTruncStore(Chain, SDLoc(N), Shorter,
|
||||
Ptr, ST->getPointerInfo(), ST->getMemoryVT(),
|
||||
ST->isVolatile(), ST->isNonTemporal(),
|
||||
ST->getAlignment());
|
||||
Ptr, ST->getMemoryVT(), ST->getMemOperand());
|
||||
|
||||
// Otherwise, see if we can simplify the operation with
|
||||
// SimplifyDemandedBits, which only works if the value has a single use.
|
||||
@ -9232,9 +9190,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
|
||||
TLI.isTruncStoreLegal(Value.getOperand(0).getValueType(),
|
||||
ST->getMemoryVT())) {
|
||||
return DAG.getTruncStore(Chain, SDLoc(N), Value.getOperand(0),
|
||||
Ptr, ST->getPointerInfo(), ST->getMemoryVT(),
|
||||
ST->isVolatile(), ST->isNonTemporal(),
|
||||
ST->getAlignment());
|
||||
Ptr, ST->getMemoryVT(), ST->getMemOperand());
|
||||
}
|
||||
|
||||
// Only perform this optimization before the types are legal, because we
|
||||
@ -9492,13 +9448,14 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
|
||||
? ISD::ZEXTLOAD : ISD::EXTLOAD;
|
||||
Load = DAG.getExtLoad(ExtType, SDLoc(N), NVT, LN0->getChain(),
|
||||
NewPtr, LN0->getPointerInfo().getWithOffset(PtrOff),
|
||||
LVT, LN0->isVolatile(), LN0->isNonTemporal(),Align);
|
||||
LVT, LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
Align, LN0->getTBAAInfo());
|
||||
Chain = Load.getValue(1);
|
||||
} else {
|
||||
Load = DAG.getLoad(LVT, SDLoc(N), LN0->getChain(), NewPtr,
|
||||
LN0->getPointerInfo().getWithOffset(PtrOff),
|
||||
LN0->isVolatile(), LN0->isNonTemporal(),
|
||||
LN0->isInvariant(), Align);
|
||||
LN0->isInvariant(), Align, LN0->getTBAAInfo());
|
||||
Chain = Load.getValue(1);
|
||||
if (NVT.bitsLT(LVT))
|
||||
Load = DAG.getNode(ISD::TRUNCATE, SDLoc(N), NVT, Load);
|
||||
@ -10437,7 +10394,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
if (LLD->getExtensionType() == ISD::NON_EXTLOAD) {
|
||||
Load = DAG.getLoad(TheSelect->getValueType(0),
|
||||
SDLoc(TheSelect),
|
||||
// FIXME: Discards pointer info.
|
||||
// FIXME: Discards pointer and TBAA info.
|
||||
LLD->getChain(), Addr, MachinePointerInfo(),
|
||||
LLD->isVolatile(), LLD->isNonTemporal(),
|
||||
LLD->isInvariant(), LLD->getAlignment());
|
||||
@ -10446,7 +10403,7 @@ bool DAGCombiner::SimplifySelectOps(SDNode *TheSelect, SDValue LHS,
|
||||
RLD->getExtensionType() : LLD->getExtensionType(),
|
||||
SDLoc(TheSelect),
|
||||
TheSelect->getValueType(0),
|
||||
// FIXME: Discards pointer info.
|
||||
// FIXME: Discards pointer and TBAA info.
|
||||
LLD->getChain(), Addr, MachinePointerInfo(),
|
||||
LLD->getMemoryVT(), LLD->isVolatile(),
|
||||
LLD->isNonTemporal(), LLD->getAlignment());
|
||||
|
@ -381,7 +381,8 @@ static void ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
|
||||
.getWithOffset(Offset),
|
||||
MemVT, ST->isVolatile(),
|
||||
ST->isNonTemporal(),
|
||||
MinAlign(ST->getAlignment(), Offset)));
|
||||
MinAlign(ST->getAlignment(), Offset),
|
||||
ST->getTBAAInfo()));
|
||||
// The order of the stores doesn't matter - say it with a TokenFactor.
|
||||
SDValue Result =
|
||||
DAG.getNode(ISD::TokenFactor, dl, MVT::Other, &Stores[0],
|
||||
@ -414,7 +415,7 @@ static void ExpandUnalignedStore(StoreSDNode *ST, SelectionDAG &DAG,
|
||||
Store2 = DAG.getTruncStore(Chain, dl, TLI.isLittleEndian()?Hi:Lo, Ptr,
|
||||
ST->getPointerInfo().getWithOffset(IncrementSize),
|
||||
NewStoredVT, ST->isVolatile(), ST->isNonTemporal(),
|
||||
Alignment);
|
||||
Alignment, ST->getTBAAInfo());
|
||||
|
||||
SDValue Result =
|
||||
DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Store1, Store2);
|
||||
@ -438,10 +439,8 @@ ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
|
||||
if (TLI.isTypeLegal(intVT) && TLI.isTypeLegal(LoadedVT)) {
|
||||
// Expand to a (misaligned) integer load of the same size,
|
||||
// then bitconvert to floating point or vector.
|
||||
SDValue newLoad = DAG.getLoad(intVT, dl, Chain, Ptr, LD->getPointerInfo(),
|
||||
LD->isVolatile(),
|
||||
LD->isNonTemporal(),
|
||||
LD->isInvariant(), LD->getAlignment());
|
||||
SDValue newLoad = DAG.getLoad(intVT, dl, Chain, Ptr,
|
||||
LD->getMemOperand());
|
||||
SDValue Result = DAG.getNode(ISD::BITCAST, dl, LoadedVT, newLoad);
|
||||
if (LoadedVT != VT)
|
||||
Result = DAG.getNode(VT.isFloatingPoint() ? ISD::FP_EXTEND :
|
||||
@ -474,7 +473,8 @@ ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
|
||||
LD->getPointerInfo().getWithOffset(Offset),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(),
|
||||
MinAlign(LD->getAlignment(), Offset));
|
||||
MinAlign(LD->getAlignment(), Offset),
|
||||
LD->getTBAAInfo());
|
||||
// Follow the load with a store to the stack slot. Remember the store.
|
||||
Stores.push_back(DAG.getStore(Load.getValue(1), dl, Load, StackPtr,
|
||||
MachinePointerInfo(), false, false, 0));
|
||||
@ -492,7 +492,8 @@ ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
|
||||
LD->getPointerInfo().getWithOffset(Offset),
|
||||
MemVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(),
|
||||
MinAlign(LD->getAlignment(), Offset));
|
||||
MinAlign(LD->getAlignment(), Offset),
|
||||
LD->getTBAAInfo());
|
||||
// Follow the load with a store to the stack slot. Remember the store.
|
||||
// On big-endian machines this requires a truncating store to ensure
|
||||
// that the bits end up in the right place.
|
||||
@ -536,23 +537,25 @@ ExpandUnalignedLoad(LoadSDNode *LD, SelectionDAG &DAG,
|
||||
if (TLI.isLittleEndian()) {
|
||||
Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr, LD->getPointerInfo(),
|
||||
NewLoadedVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), Alignment);
|
||||
LD->isNonTemporal(), Alignment, LD->getTBAAInfo());
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(IncrementSize, Ptr.getValueType()));
|
||||
Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
NewLoadedVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), MinAlign(Alignment,IncrementSize));
|
||||
LD->isNonTemporal(), MinAlign(Alignment, IncrementSize),
|
||||
LD->getTBAAInfo());
|
||||
} else {
|
||||
Hi = DAG.getExtLoad(HiExtType, dl, VT, Chain, Ptr, LD->getPointerInfo(),
|
||||
NewLoadedVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), Alignment);
|
||||
LD->isNonTemporal(), Alignment, LD->getTBAAInfo());
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(IncrementSize, Ptr.getValueType()));
|
||||
Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, VT, Chain, Ptr,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
NewLoadedVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), MinAlign(Alignment,IncrementSize));
|
||||
LD->isNonTemporal(), MinAlign(Alignment, IncrementSize),
|
||||
LD->getTBAAInfo());
|
||||
}
|
||||
|
||||
// aggregate the two parts
|
||||
@ -655,6 +658,7 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
|
||||
unsigned Alignment = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
SDLoc dl(ST);
|
||||
if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(ST->getValue())) {
|
||||
if (CFP->getValueType(0) == MVT::f32 &&
|
||||
@ -663,7 +667,7 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
|
||||
bitcastToAPInt().zextOrTrunc(32),
|
||||
MVT::i32);
|
||||
return DAG.getStore(Chain, dl, Con, Ptr, ST->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
}
|
||||
|
||||
if (CFP->getValueType(0) == MVT::f64) {
|
||||
@ -672,7 +676,7 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
|
||||
SDValue Con = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
|
||||
zextOrTrunc(64), MVT::i64);
|
||||
return DAG.getStore(Chain, dl, Con, Ptr, ST->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
}
|
||||
|
||||
if (TLI.isTypeLegal(MVT::i32) && !ST->isVolatile()) {
|
||||
@ -685,12 +689,13 @@ SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) {
|
||||
if (TLI.isBigEndian()) std::swap(Lo, Hi);
|
||||
|
||||
Lo = DAG.getStore(Chain, dl, Lo, Ptr, ST->getPointerInfo(), isVolatile,
|
||||
isNonTemporal, Alignment);
|
||||
isNonTemporal, Alignment, TBAAInfo);
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(4, Ptr.getValueType()));
|
||||
Hi = DAG.getStore(Chain, dl, Hi, Ptr,
|
||||
ST->getPointerInfo().getWithOffset(4),
|
||||
isVolatile, isNonTemporal, MinAlign(Alignment, 4U));
|
||||
isVolatile, isNonTemporal, MinAlign(Alignment, 4U),
|
||||
TBAAInfo);
|
||||
|
||||
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
|
||||
}
|
||||
@ -708,6 +713,7 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
unsigned Alignment = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
|
||||
if (!ST->isTruncatingStore()) {
|
||||
if (SDNode *OptStore = OptimizeFloatStore(ST).getNode()) {
|
||||
@ -745,7 +751,7 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
SDValue Result =
|
||||
DAG.getStore(Chain, dl, Value, Ptr,
|
||||
ST->getPointerInfo(), isVolatile,
|
||||
isNonTemporal, Alignment);
|
||||
isNonTemporal, Alignment, TBAAInfo);
|
||||
ReplaceNode(SDValue(Node, 0), Result);
|
||||
break;
|
||||
}
|
||||
@ -767,7 +773,8 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
Value = DAG.getZeroExtendInReg(Value, dl, StVT);
|
||||
SDValue Result =
|
||||
DAG.getTruncStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
|
||||
NVT, isVolatile, isNonTemporal, Alignment);
|
||||
NVT, isVolatile, isNonTemporal, Alignment,
|
||||
TBAAInfo);
|
||||
ReplaceNode(SDValue(Node, 0), Result);
|
||||
} else if (StWidth & (StWidth - 1)) {
|
||||
// If not storing a power-of-2 number of bits, expand as two stores.
|
||||
@ -788,7 +795,8 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
// Store the bottom RoundWidth bits.
|
||||
Lo = DAG.getTruncStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
|
||||
RoundVT,
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment,
|
||||
TBAAInfo);
|
||||
|
||||
// Store the remaining ExtraWidth bits.
|
||||
IncrementSize = RoundWidth / 8;
|
||||
@ -800,7 +808,7 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
Hi = DAG.getTruncStore(Chain, dl, Hi, Ptr,
|
||||
ST->getPointerInfo().getWithOffset(IncrementSize),
|
||||
ExtraVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
} else {
|
||||
// Big endian - avoid unaligned stores.
|
||||
// TRUNCSTORE:i24 X -> TRUNCSTORE:i16 (srl X, 8), TRUNCSTORE@+2:i8 X
|
||||
@ -809,7 +817,8 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
DAG.getConstant(ExtraWidth,
|
||||
TLI.getShiftAmountTy(Value.getValueType())));
|
||||
Hi = DAG.getTruncStore(Chain, dl, Hi, Ptr, ST->getPointerInfo(),
|
||||
RoundVT, isVolatile, isNonTemporal, Alignment);
|
||||
RoundVT, isVolatile, isNonTemporal, Alignment,
|
||||
TBAAInfo);
|
||||
|
||||
// Store the remaining ExtraWidth bits.
|
||||
IncrementSize = RoundWidth / 8;
|
||||
@ -818,7 +827,7 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
Lo = DAG.getTruncStore(Chain, dl, Value, Ptr,
|
||||
ST->getPointerInfo().getWithOffset(IncrementSize),
|
||||
ExtraVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
}
|
||||
|
||||
// The order of the stores doesn't matter.
|
||||
@ -854,7 +863,7 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
|
||||
Value = DAG.getNode(ISD::TRUNCATE, dl, StVT, Value);
|
||||
SDValue Result =
|
||||
DAG.getStore(Chain, dl, Value, Ptr, ST->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
ReplaceNode(SDValue(Node, 0), Result);
|
||||
break;
|
||||
}
|
||||
@ -902,9 +911,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
assert(NVT.getSizeInBits() == VT.getSizeInBits() &&
|
||||
"Can only promote loads to same size type");
|
||||
|
||||
SDValue Res = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(), LD->getAlignment());
|
||||
SDValue Res = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getMemOperand());
|
||||
RVal = DAG.getNode(ISD::BITCAST, dl, VT, Res);
|
||||
RChain = Res.getValue(1);
|
||||
break;
|
||||
@ -924,6 +931,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
unsigned Alignment = LD->getAlignment();
|
||||
bool isVolatile = LD->isVolatile();
|
||||
bool isNonTemporal = LD->isNonTemporal();
|
||||
const MDNode *TBAAInfo = LD->getTBAAInfo();
|
||||
|
||||
if (SrcWidth != SrcVT.getStoreSizeInBits() &&
|
||||
// Some targets pretend to have an i1 loading operation, and actually
|
||||
@ -950,7 +958,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
SDValue Result =
|
||||
DAG.getExtLoad(NewExtType, dl, Node->getValueType(0),
|
||||
Chain, Ptr, LD->getPointerInfo(),
|
||||
NVT, isVolatile, isNonTemporal, Alignment);
|
||||
NVT, isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
Ch = Result.getValue(1); // The chain.
|
||||
|
||||
@ -987,7 +995,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
Lo = DAG.getExtLoad(ISD::ZEXTLOAD, dl, Node->getValueType(0),
|
||||
Chain, Ptr,
|
||||
LD->getPointerInfo(), RoundVT, isVolatile,
|
||||
isNonTemporal, Alignment);
|
||||
isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
// Load the remaining ExtraWidth bits.
|
||||
IncrementSize = RoundWidth / 8;
|
||||
@ -996,7 +1004,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Chain, Ptr,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
ExtraVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of
|
||||
// the other one.
|
||||
@ -1016,7 +1024,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
// Load the top RoundWidth bits.
|
||||
Hi = DAG.getExtLoad(ExtType, dl, Node->getValueType(0), Chain, Ptr,
|
||||
LD->getPointerInfo(), RoundVT, isVolatile,
|
||||
isNonTemporal, Alignment);
|
||||
isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
// Load the remaining ExtraWidth bits.
|
||||
IncrementSize = RoundWidth / 8;
|
||||
@ -1026,7 +1034,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
dl, Node->getValueType(0), Chain, Ptr,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
ExtraVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of
|
||||
// the other one.
|
||||
@ -1079,9 +1087,7 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
case TargetLowering::Expand:
|
||||
if (!TLI.isLoadExtLegal(ISD::EXTLOAD, SrcVT) && TLI.isTypeLegal(SrcVT)) {
|
||||
SDValue Load = DAG.getLoad(SrcVT, dl, Chain, Ptr,
|
||||
LD->getPointerInfo(),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(), LD->getAlignment());
|
||||
LD->getMemOperand());
|
||||
unsigned ExtendOp;
|
||||
switch (ExtType) {
|
||||
case ISD::EXTLOAD:
|
||||
@ -1109,9 +1115,8 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
|
||||
// Turn the unsupported load into an EXTLOAD followed by an explicit
|
||||
// zero/sign extend inreg.
|
||||
SDValue Result = DAG.getExtLoad(ISD::EXTLOAD, dl, Node->getValueType(0),
|
||||
Chain, Ptr, LD->getPointerInfo(), SrcVT,
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->getAlignment());
|
||||
Chain, Ptr, SrcVT,
|
||||
LD->getMemOperand());
|
||||
SDValue ValRes;
|
||||
if (ExtType == ISD::SEXTLOAD)
|
||||
ValRes = DAG.getNode(ISD::SIGN_EXTEND_INREG, dl,
|
||||
|
@ -517,7 +517,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
|
||||
NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(),
|
||||
NVT, dl, L->getChain(), L->getBasePtr(), L->getOffset(),
|
||||
L->getPointerInfo(), NVT, L->isVolatile(),
|
||||
L->isNonTemporal(), false, L->getAlignment());
|
||||
L->isNonTemporal(), false, L->getAlignment(),
|
||||
L->getTBAAInfo());
|
||||
// Legalized the chain result - switch anything that used the old chain to
|
||||
// use the new one.
|
||||
ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
|
||||
@ -529,7 +530,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) {
|
||||
L->getMemoryVT(), dl, L->getChain(),
|
||||
L->getBasePtr(), L->getOffset(), L->getPointerInfo(),
|
||||
L->getMemoryVT(), L->isVolatile(),
|
||||
L->isNonTemporal(), false, L->getAlignment());
|
||||
L->isNonTemporal(), false, L->getAlignment(),
|
||||
L->getTBAAInfo());
|
||||
// Legalized the chain result - switch anything that used the old chain to
|
||||
// use the new one.
|
||||
ReplaceValueWith(SDValue(N, 1), NewL.getValue(1));
|
||||
@ -767,9 +769,7 @@ SDValue DAGTypeLegalizer::SoftenFloatOp_STORE(SDNode *N, unsigned OpNo) {
|
||||
Val = GetSoftenedFloat(Val);
|
||||
|
||||
return DAG.getStore(ST->getChain(), dl, Val, ST->getBasePtr(),
|
||||
ST->getPointerInfo(),
|
||||
ST->isVolatile(), ST->isNonTemporal(),
|
||||
ST->getAlignment());
|
||||
ST->getMemOperand());
|
||||
}
|
||||
|
||||
|
||||
@ -1160,8 +1160,7 @@ void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDValue &Lo,
|
||||
assert(LD->getMemoryVT().bitsLE(NVT) && "Float type not round?");
|
||||
|
||||
Hi = DAG.getExtLoad(LD->getExtensionType(), dl, NVT, Chain, Ptr,
|
||||
LD->getPointerInfo(), LD->getMemoryVT(), LD->isVolatile(),
|
||||
LD->isNonTemporal(), LD->getAlignment());
|
||||
LD->getMemoryVT(), LD->getMemOperand());
|
||||
|
||||
// Remember the chain.
|
||||
Chain = Hi.getValue(1);
|
||||
@ -1483,7 +1482,5 @@ SDValue DAGTypeLegalizer::ExpandFloatOp_STORE(SDNode *N, unsigned OpNo) {
|
||||
GetExpandedOp(ST->getValue(), Lo, Hi);
|
||||
|
||||
return DAG.getTruncStore(Chain, SDLoc(N), Hi, Ptr,
|
||||
ST->getPointerInfo(),
|
||||
ST->getMemoryVT(), ST->isVolatile(),
|
||||
ST->isNonTemporal(), ST->getAlignment());
|
||||
ST->getMemoryVT(), ST->getMemOperand());
|
||||
}
|
||||
|
@ -417,9 +417,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_LOAD(LoadSDNode *N) {
|
||||
ISD::isNON_EXTLoad(N) ? ISD::EXTLOAD : N->getExtensionType();
|
||||
SDLoc dl(N);
|
||||
SDValue Res = DAG.getExtLoad(ExtType, dl, NVT, N->getChain(), N->getBasePtr(),
|
||||
N->getPointerInfo(),
|
||||
N->getMemoryVT(), N->isVolatile(),
|
||||
N->isNonTemporal(), N->getAlignment());
|
||||
N->getMemoryVT(), N->getMemOperand());
|
||||
|
||||
// Legalized the chain result - switch anything that used the old chain to
|
||||
// use the new one.
|
||||
@ -1038,17 +1036,13 @@ SDValue DAGTypeLegalizer::PromoteIntOp_SINT_TO_FP(SDNode *N) {
|
||||
SDValue DAGTypeLegalizer::PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo){
|
||||
assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!");
|
||||
SDValue Ch = N->getChain(), Ptr = N->getBasePtr();
|
||||
unsigned Alignment = N->getAlignment();
|
||||
bool isVolatile = N->isVolatile();
|
||||
bool isNonTemporal = N->isNonTemporal();
|
||||
SDLoc dl(N);
|
||||
|
||||
SDValue Val = GetPromotedInteger(N->getValue()); // Get promoted value.
|
||||
|
||||
// Truncate the value and store the result.
|
||||
return DAG.getTruncStore(Ch, dl, Val, Ptr, N->getPointerInfo(),
|
||||
N->getMemoryVT(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
return DAG.getTruncStore(Ch, dl, Val, Ptr,
|
||||
N->getMemoryVT(), N->getMemOperand());
|
||||
}
|
||||
|
||||
SDValue DAGTypeLegalizer::PromoteIntOp_TRUNCATE(SDNode *N) {
|
||||
@ -1814,6 +1808,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
bool isVolatile = N->isVolatile();
|
||||
bool isNonTemporal = N->isNonTemporal();
|
||||
bool isInvariant = N->isInvariant();
|
||||
const MDNode *TBAAInfo = N->getTBAAInfo();
|
||||
SDLoc dl(N);
|
||||
|
||||
assert(NVT.isByteSized() && "Expanded type not byte sized!");
|
||||
@ -1822,7 +1817,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
EVT MemVT = N->getMemoryVT();
|
||||
|
||||
Lo = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(),
|
||||
MemVT, isVolatile, isNonTemporal, Alignment);
|
||||
MemVT, isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
// Remember the chain.
|
||||
Ch = Lo.getValue(1);
|
||||
@ -1844,7 +1839,8 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
} else if (TLI.isLittleEndian()) {
|
||||
// Little-endian - low bits are at low addresses.
|
||||
Lo = DAG.getLoad(NVT, dl, Ch, Ptr, N->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, isInvariant, Alignment);
|
||||
isVolatile, isNonTemporal, isInvariant, Alignment,
|
||||
TBAAInfo);
|
||||
|
||||
unsigned ExcessBits =
|
||||
N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
|
||||
@ -1857,7 +1853,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr,
|
||||
N->getPointerInfo().getWithOffset(IncrementSize), NEVT,
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of the
|
||||
// other one.
|
||||
@ -1875,7 +1871,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
Hi = DAG.getExtLoad(ExtType, dl, NVT, Ch, Ptr, N->getPointerInfo(),
|
||||
EVT::getIntegerVT(*DAG.getContext(),
|
||||
MemVT.getSizeInBits() - ExcessBits),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
// Increment the pointer to the other half.
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
@ -1885,7 +1881,7 @@ void DAGTypeLegalizer::ExpandIntRes_LOAD(LoadSDNode *N,
|
||||
N->getPointerInfo().getWithOffset(IncrementSize),
|
||||
EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of the
|
||||
// other one.
|
||||
@ -2715,6 +2711,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
unsigned Alignment = N->getAlignment();
|
||||
bool isVolatile = N->isVolatile();
|
||||
bool isNonTemporal = N->isNonTemporal();
|
||||
const MDNode *TBAAInfo = N->getTBAAInfo();
|
||||
SDLoc dl(N);
|
||||
SDValue Lo, Hi;
|
||||
|
||||
@ -2724,7 +2721,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
GetExpandedInteger(N->getValue(), Lo, Hi);
|
||||
return DAG.getTruncStore(Ch, dl, Lo, Ptr, N->getPointerInfo(),
|
||||
N->getMemoryVT(), isVolatile, isNonTemporal,
|
||||
Alignment);
|
||||
Alignment, TBAAInfo);
|
||||
}
|
||||
|
||||
if (TLI.isLittleEndian()) {
|
||||
@ -2732,7 +2729,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
GetExpandedInteger(N->getValue(), Lo, Hi);
|
||||
|
||||
Lo = DAG.getStore(Ch, dl, Lo, Ptr, N->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
unsigned ExcessBits =
|
||||
N->getMemoryVT().getSizeInBits() - NVT.getSizeInBits();
|
||||
@ -2745,7 +2742,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr,
|
||||
N->getPointerInfo().getWithOffset(IncrementSize),
|
||||
NEVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
|
||||
}
|
||||
|
||||
@ -2773,7 +2770,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
|
||||
// Store both the high bits and maybe some of the low bits.
|
||||
Hi = DAG.getTruncStore(Ch, dl, Hi, Ptr, N->getPointerInfo(),
|
||||
HiVT, isVolatile, isNonTemporal, Alignment);
|
||||
HiVT, isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
// Increment the pointer to the other half.
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
@ -2783,7 +2780,7 @@ SDValue DAGTypeLegalizer::ExpandIntOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
N->getPointerInfo().getWithOffset(IncrementSize),
|
||||
EVT::getIntegerVT(*DAG.getContext(), ExcessBits),
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
|
||||
}
|
||||
|
||||
|
@ -254,11 +254,13 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo,
|
||||
bool isVolatile = LD->isVolatile();
|
||||
bool isNonTemporal = LD->isNonTemporal();
|
||||
bool isInvariant = LD->isInvariant();
|
||||
const MDNode *TBAAInfo = LD->getTBAAInfo();
|
||||
|
||||
assert(NVT.isByteSized() && "Expanded type not byte sized!");
|
||||
|
||||
Lo = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, isInvariant, Alignment);
|
||||
isVolatile, isNonTemporal, isInvariant, Alignment,
|
||||
TBAAInfo);
|
||||
|
||||
// Increment the pointer to the other half.
|
||||
unsigned IncrementSize = NVT.getSizeInBits() / 8;
|
||||
@ -267,7 +269,7 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo,
|
||||
Hi = DAG.getLoad(NVT, dl, Chain, Ptr,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
isVolatile, isNonTemporal, isInvariant,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of the
|
||||
// other one.
|
||||
@ -440,6 +442,7 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
|
||||
unsigned Alignment = St->getAlignment();
|
||||
bool isVolatile = St->isVolatile();
|
||||
bool isNonTemporal = St->isNonTemporal();
|
||||
const MDNode *TBAAInfo = St->getTBAAInfo();
|
||||
|
||||
assert(NVT.isByteSized() && "Expanded type not byte sized!");
|
||||
unsigned IncrementSize = NVT.getSizeInBits() / 8;
|
||||
@ -451,14 +454,14 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
|
||||
std::swap(Lo, Hi);
|
||||
|
||||
Lo = DAG.getStore(Chain, dl, Lo, Ptr, St->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(IncrementSize, Ptr.getValueType()));
|
||||
Hi = DAG.getStore(Chain, dl, Hi, Ptr,
|
||||
St->getPointerInfo().getWithOffset(IncrementSize),
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Alignment, IncrementSize));
|
||||
MinAlign(Alignment, IncrementSize), TBAAInfo);
|
||||
|
||||
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Lo, Hi);
|
||||
}
|
||||
|
@ -418,7 +418,8 @@ SDValue VectorLegalizer::ExpandLoad(SDValue Op) {
|
||||
ScalarLoad = DAG.getLoad(WideVT, dl, Chain, BasePTR,
|
||||
LD->getPointerInfo().getWithOffset(Offset),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->isInvariant(), LD->getAlignment());
|
||||
LD->isInvariant(), LD->getAlignment(),
|
||||
LD->getTBAAInfo());
|
||||
} else {
|
||||
EVT LoadVT = WideVT;
|
||||
while (RemainingBytes < LoadBytes) {
|
||||
@ -428,7 +429,8 @@ SDValue VectorLegalizer::ExpandLoad(SDValue Op) {
|
||||
ScalarLoad = DAG.getExtLoad(ISD::EXTLOAD, dl, WideVT, Chain, BasePTR,
|
||||
LD->getPointerInfo().getWithOffset(Offset),
|
||||
LoadVT, LD->isVolatile(),
|
||||
LD->isNonTemporal(), LD->getAlignment());
|
||||
LD->isNonTemporal(), LD->getAlignment(),
|
||||
LD->getTBAAInfo());
|
||||
}
|
||||
|
||||
RemainingBytes -= LoadBytes;
|
||||
@ -499,7 +501,7 @@ SDValue VectorLegalizer::ExpandLoad(SDValue Op) {
|
||||
Chain, BasePTR, LD->getPointerInfo().getWithOffset(Idx * Stride),
|
||||
SrcVT.getScalarType(),
|
||||
LD->isVolatile(), LD->isNonTemporal(),
|
||||
LD->getAlignment());
|
||||
LD->getAlignment(), LD->getTBAAInfo());
|
||||
|
||||
BasePTR = DAG.getNode(ISD::ADD, dl, BasePTR.getValueType(), BasePTR,
|
||||
DAG.getConstant(Stride, BasePTR.getValueType()));
|
||||
@ -531,6 +533,7 @@ SDValue VectorLegalizer::ExpandStore(SDValue Op) {
|
||||
unsigned Alignment = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
|
||||
unsigned NumElem = StVT.getVectorNumElements();
|
||||
// The type of the data we want to save
|
||||
@ -558,7 +561,7 @@ SDValue VectorLegalizer::ExpandStore(SDValue Op) {
|
||||
// This scalar TruncStore may be illegal, but we legalize it later.
|
||||
SDValue Store = DAG.getTruncStore(Chain, dl, Ex, BasePTR,
|
||||
ST->getPointerInfo().getWithOffset(Idx*Stride), MemSclVT,
|
||||
isVolatile, isNonTemporal, Alignment);
|
||||
isVolatile, isNonTemporal, Alignment, TBAAInfo);
|
||||
|
||||
BasePTR = DAG.getNode(ISD::ADD, dl, BasePTR.getValueType(), BasePTR,
|
||||
DAG.getConstant(Stride, BasePTR.getValueType()));
|
||||
|
@ -217,7 +217,8 @@ SDValue DAGTypeLegalizer::ScalarizeVecRes_LOAD(LoadSDNode *N) {
|
||||
N->getPointerInfo(),
|
||||
N->getMemoryVT().getVectorElementType(),
|
||||
N->isVolatile(), N->isNonTemporal(),
|
||||
N->isInvariant(), N->getOriginalAlignment());
|
||||
N->isInvariant(), N->getOriginalAlignment(),
|
||||
N->getTBAAInfo());
|
||||
|
||||
// Legalized the chain result - switch anything that used the old chain to
|
||||
// use the new one.
|
||||
@ -458,12 +459,12 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo){
|
||||
N->getBasePtr(), N->getPointerInfo(),
|
||||
N->getMemoryVT().getVectorElementType(),
|
||||
N->isVolatile(), N->isNonTemporal(),
|
||||
N->getAlignment());
|
||||
N->getAlignment(), N->getTBAAInfo());
|
||||
|
||||
return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)),
|
||||
N->getBasePtr(), N->getPointerInfo(),
|
||||
N->isVolatile(), N->isNonTemporal(),
|
||||
N->getOriginalAlignment());
|
||||
N->getOriginalAlignment(), N->getTBAAInfo());
|
||||
}
|
||||
|
||||
|
||||
@ -820,20 +821,22 @@ void DAGTypeLegalizer::SplitVecRes_LOAD(LoadSDNode *LD, SDValue &Lo,
|
||||
bool isVolatile = LD->isVolatile();
|
||||
bool isNonTemporal = LD->isNonTemporal();
|
||||
bool isInvariant = LD->isInvariant();
|
||||
const MDNode *TBAAInfo = LD->getTBAAInfo();
|
||||
|
||||
EVT LoMemVT, HiMemVT;
|
||||
GetSplitDestVTs(MemoryVT, LoMemVT, HiMemVT);
|
||||
|
||||
Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, LoVT, dl, Ch, Ptr, Offset,
|
||||
LD->getPointerInfo(), LoMemVT, isVolatile, isNonTemporal,
|
||||
isInvariant, Alignment);
|
||||
isInvariant, Alignment, TBAAInfo);
|
||||
|
||||
unsigned IncrementSize = LoMemVT.getSizeInBits()/8;
|
||||
Ptr = DAG.getNode(ISD::ADD, dl, Ptr.getValueType(), Ptr,
|
||||
DAG.getConstant(IncrementSize, Ptr.getValueType()));
|
||||
Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, HiVT, dl, Ch, Ptr, Offset,
|
||||
LD->getPointerInfo().getWithOffset(IncrementSize),
|
||||
HiMemVT, isVolatile, isNonTemporal, isInvariant, Alignment);
|
||||
HiMemVT, isVolatile, isNonTemporal, isInvariant, Alignment,
|
||||
TBAAInfo);
|
||||
|
||||
// Build a factor node to remember that this load is independent of the
|
||||
// other one.
|
||||
@ -1254,6 +1257,7 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
unsigned Alignment = N->getOriginalAlignment();
|
||||
bool isVol = N->isVolatile();
|
||||
bool isNT = N->isNonTemporal();
|
||||
const MDNode *TBAAInfo = N->getTBAAInfo();
|
||||
SDValue Lo, Hi;
|
||||
GetSplitVector(N->getOperand(1), Lo, Hi);
|
||||
|
||||
@ -1264,10 +1268,10 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
|
||||
if (isTruncating)
|
||||
Lo = DAG.getTruncStore(Ch, DL, Lo, Ptr, N->getPointerInfo(),
|
||||
LoMemVT, isVol, isNT, Alignment);
|
||||
LoMemVT, isVol, isNT, Alignment, TBAAInfo);
|
||||
else
|
||||
Lo = DAG.getStore(Ch, DL, Lo, Ptr, N->getPointerInfo(),
|
||||
isVol, isNT, Alignment);
|
||||
isVol, isNT, Alignment, TBAAInfo);
|
||||
|
||||
// Increment the pointer to the other half.
|
||||
Ptr = DAG.getNode(ISD::ADD, DL, Ptr.getValueType(), Ptr,
|
||||
@ -1276,11 +1280,11 @@ SDValue DAGTypeLegalizer::SplitVecOp_STORE(StoreSDNode *N, unsigned OpNo) {
|
||||
if (isTruncating)
|
||||
Hi = DAG.getTruncStore(Ch, DL, Hi, Ptr,
|
||||
N->getPointerInfo().getWithOffset(IncrementSize),
|
||||
HiMemVT, isVol, isNT, Alignment);
|
||||
HiMemVT, isVol, isNT, Alignment, TBAAInfo);
|
||||
else
|
||||
Hi = DAG.getStore(Ch, DL, Hi, Ptr,
|
||||
N->getPointerInfo().getWithOffset(IncrementSize),
|
||||
isVol, isNT, Alignment);
|
||||
isVol, isNT, Alignment, TBAAInfo);
|
||||
|
||||
return DAG.getNode(ISD::TokenFactor, DL, MVT::Other, Lo, Hi);
|
||||
}
|
||||
@ -2551,6 +2555,7 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
bool isVolatile = LD->isVolatile();
|
||||
bool isNonTemporal = LD->isNonTemporal();
|
||||
bool isInvariant = LD->isInvariant();
|
||||
const MDNode *TBAAInfo = LD->getTBAAInfo();
|
||||
|
||||
int LdWidth = LdVT.getSizeInBits();
|
||||
int WidthDiff = WidenWidth - LdWidth; // Difference
|
||||
@ -2560,7 +2565,8 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
EVT NewVT = FindMemType(DAG, TLI, LdWidth, WidenVT, LdAlign, WidthDiff);
|
||||
int NewVTWidth = NewVT.getSizeInBits();
|
||||
SDValue LdOp = DAG.getLoad(NewVT, dl, Chain, BasePtr, LD->getPointerInfo(),
|
||||
isVolatile, isNonTemporal, isInvariant, Align);
|
||||
isVolatile, isNonTemporal, isInvariant, Align,
|
||||
TBAAInfo);
|
||||
LdChain.push_back(LdOp.getValue(1));
|
||||
|
||||
// Check if we can load the element with one instruction
|
||||
@ -2605,7 +2611,8 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
NewVTWidth = NewVT.getSizeInBits();
|
||||
L = DAG.getLoad(NewVT, dl, Chain, BasePtr,
|
||||
LD->getPointerInfo().getWithOffset(Offset), isVolatile,
|
||||
isNonTemporal, isInvariant, MinAlign(Align, Increment));
|
||||
isNonTemporal, isInvariant, MinAlign(Align, Increment),
|
||||
TBAAInfo);
|
||||
LdChain.push_back(L.getValue(1));
|
||||
if (L->getValueType(0).isVector()) {
|
||||
SmallVector<SDValue, 16> Loads;
|
||||
@ -2621,7 +2628,8 @@ SDValue DAGTypeLegalizer::GenWidenVectorLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
} else {
|
||||
L = DAG.getLoad(NewVT, dl, Chain, BasePtr,
|
||||
LD->getPointerInfo().getWithOffset(Offset), isVolatile,
|
||||
isNonTemporal, isInvariant, MinAlign(Align, Increment));
|
||||
isNonTemporal, isInvariant, MinAlign(Align, Increment),
|
||||
TBAAInfo);
|
||||
LdChain.push_back(L.getValue(1));
|
||||
}
|
||||
|
||||
@ -2701,6 +2709,7 @@ DAGTypeLegalizer::GenWidenVectorExtLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
unsigned Align = LD->getAlignment();
|
||||
bool isVolatile = LD->isVolatile();
|
||||
bool isNonTemporal = LD->isNonTemporal();
|
||||
const MDNode *TBAAInfo = LD->getTBAAInfo();
|
||||
|
||||
EVT EltVT = WidenVT.getVectorElementType();
|
||||
EVT LdEltVT = LdVT.getVectorElementType();
|
||||
@ -2712,7 +2721,7 @@ DAGTypeLegalizer::GenWidenVectorExtLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
unsigned Increment = LdEltVT.getSizeInBits() / 8;
|
||||
Ops[0] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, BasePtr,
|
||||
LD->getPointerInfo(),
|
||||
LdEltVT, isVolatile, isNonTemporal, Align);
|
||||
LdEltVT, isVolatile, isNonTemporal, Align, TBAAInfo);
|
||||
LdChain.push_back(Ops[0].getValue(1));
|
||||
unsigned i = 0, Offset = Increment;
|
||||
for (i=1; i < NumElts; ++i, Offset += Increment) {
|
||||
@ -2722,7 +2731,7 @@ DAGTypeLegalizer::GenWidenVectorExtLoads(SmallVectorImpl<SDValue> &LdChain,
|
||||
BasePtr.getValueType()));
|
||||
Ops[i] = DAG.getExtLoad(ExtType, dl, EltVT, Chain, NewBasePtr,
|
||||
LD->getPointerInfo().getWithOffset(Offset), LdEltVT,
|
||||
isVolatile, isNonTemporal, Align);
|
||||
isVolatile, isNonTemporal, Align, TBAAInfo);
|
||||
LdChain.push_back(Ops[i].getValue(1));
|
||||
}
|
||||
|
||||
@ -2745,6 +2754,7 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVectorImpl<SDValue> &StChain,
|
||||
unsigned Align = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
SDValue ValOp = GetWidenedVector(ST->getValue());
|
||||
SDLoc dl(ST);
|
||||
|
||||
@ -2771,7 +2781,7 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVectorImpl<SDValue> &StChain,
|
||||
StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr,
|
||||
ST->getPointerInfo().getWithOffset(Offset),
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Align, Offset)));
|
||||
MinAlign(Align, Offset), TBAAInfo));
|
||||
StWidth -= NewVTWidth;
|
||||
Offset += Increment;
|
||||
Idx += NumVTElts;
|
||||
@ -2791,7 +2801,7 @@ void DAGTypeLegalizer::GenWidenVectorStores(SmallVectorImpl<SDValue> &StChain,
|
||||
StChain.push_back(DAG.getStore(Chain, dl, EOp, BasePtr,
|
||||
ST->getPointerInfo().getWithOffset(Offset),
|
||||
isVolatile, isNonTemporal,
|
||||
MinAlign(Align, Offset)));
|
||||
MinAlign(Align, Offset), TBAAInfo));
|
||||
StWidth -= NewVTWidth;
|
||||
Offset += Increment;
|
||||
BasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(), BasePtr,
|
||||
@ -2813,6 +2823,7 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVectorImpl<SDValue> &StChain,
|
||||
unsigned Align = ST->getAlignment();
|
||||
bool isVolatile = ST->isVolatile();
|
||||
bool isNonTemporal = ST->isNonTemporal();
|
||||
const MDNode *TBAAInfo = ST->getTBAAInfo();
|
||||
SDValue ValOp = GetWidenedVector(ST->getValue());
|
||||
SDLoc dl(ST);
|
||||
|
||||
@ -2835,7 +2846,8 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVectorImpl<SDValue> &StChain,
|
||||
DAG.getConstant(0, TLI.getVectorIdxTy()));
|
||||
StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, BasePtr,
|
||||
ST->getPointerInfo(), StEltVT,
|
||||
isVolatile, isNonTemporal, Align));
|
||||
isVolatile, isNonTemporal, Align,
|
||||
TBAAInfo));
|
||||
unsigned Offset = Increment;
|
||||
for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
|
||||
SDValue NewBasePtr = DAG.getNode(ISD::ADD, dl, BasePtr.getValueType(),
|
||||
@ -2846,7 +2858,7 @@ DAGTypeLegalizer::GenWidenVectorTruncStores(SmallVectorImpl<SDValue> &StChain,
|
||||
StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, NewBasePtr,
|
||||
ST->getPointerInfo().getWithOffset(Offset),
|
||||
StEltVT, isVolatile, isNonTemporal,
|
||||
MinAlign(Align, Offset)));
|
||||
MinAlign(Align, Offset), TBAAInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4503,6 +4503,14 @@ SDValue SelectionDAG::getLoad(EVT VT, SDLoc dl,
|
||||
TBAAInfo, Ranges);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getLoad(EVT VT, SDLoc dl,
|
||||
SDValue Chain, SDValue Ptr,
|
||||
MachineMemOperand *MMO) {
|
||||
SDValue Undef = getUNDEF(Ptr.getValueType());
|
||||
return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
|
||||
VT, MMO);
|
||||
}
|
||||
|
||||
SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
||||
SDValue Chain, SDValue Ptr,
|
||||
MachinePointerInfo PtrInfo, EVT MemVT,
|
||||
@ -4515,6 +4523,14 @@ SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
||||
}
|
||||
|
||||
|
||||
SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, SDLoc dl, EVT VT,
|
||||
SDValue Chain, SDValue Ptr, EVT MemVT,
|
||||
MachineMemOperand *MMO) {
|
||||
SDValue Undef = getUNDEF(Ptr.getValueType());
|
||||
return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef,
|
||||
MemVT, MMO);
|
||||
}
|
||||
|
||||
SDValue
|
||||
SelectionDAG::getIndexedLoad(SDValue OrigLoad, SDLoc dl, SDValue Base,
|
||||
SDValue Offset, ISD::MemIndexedMode AM) {
|
||||
|
20
test/CodeGen/SystemZ/alias-01.ll
Normal file
20
test/CodeGen/SystemZ/alias-01.ll
Normal file
@ -0,0 +1,20 @@
|
||||
; Test 32-bit ANDs in which the second operand is variable.
|
||||
;
|
||||
; RUN: llc < %s -mtriple=s390x-linux-gnu -combiner-alias-analysis \
|
||||
; RUN: -combiner-global-alias-analysis | FileCheck %s
|
||||
|
||||
; Check that there are no spills.
|
||||
define void @f1(<16 x i32> *%src1, <16 x float> *%dest) {
|
||||
; CHECK-LABEL: f1:
|
||||
; CHECK-NOT: %r15
|
||||
; CHECK: br %r14
|
||||
%val = load <16 x i32> *%src1, !tbaa !1
|
||||
%add = add <16 x i32> %val, %val
|
||||
%res = bitcast <16 x i32> %add to <16 x float>
|
||||
store <16 x float> %res, <16 x float> *%dest, !tbaa !2
|
||||
ret void
|
||||
}
|
||||
|
||||
!0 = metadata !{ metadata !"root" }
|
||||
!1 = metadata !{ metadata !"set1", metadata !0 }
|
||||
!2 = metadata !{ metadata !"set2", metadata !0 }
|
Loading…
Reference in New Issue
Block a user