mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +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:
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user