[llvm-dev] Missing pointer info update in DAGCombiner::visitAnd()?
Mikael Holmén via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 20 06:59:37 PDT 2015
Hi,
In SDValue DAGCombiner::visitAND(SDNode *N):
// For big endian targets, we need to add an offset to the
pointer
// to load the correct bytes. For little endian systems, we
merely
// need to read fewer bytes from the same pointer.
if (DAG.getDataLayout().isBigEndian()) {
unsigned LVTStoreBytes = LoadedVT.getStoreSize();
unsigned EVTStoreBytes = ExtVT.getStoreSize();
unsigned PtrOff = LVTStoreBytes - EVTStoreBytes;
SDLoc DL(LN0);
NewPtr = DAG.getNode(ISD::ADD, DL, PtrType,
NewPtr, DAG.getConstant(PtrOff, DL,
PtrType));
Alignment = MinAlign(Alignment, PtrOff);
}
AddToWorklist(NewPtr.getNode());
SDValue Load =
DAG.getExtLoad(ISD::ZEXTLOAD, SDLoc(LN0), LoadResultTy,
LN0->getChain(), NewPtr,
LN0->getPointerInfo(),
ExtVT, LN0->isVolatile(), LN0->isNonTemporal(),
LN0->isInvariant(), Alignment,
LN0->getAAInfo());
In the big endian case where we add 'PtrOff' bytes to the pointer with
an 'ADD', shouldn't we then also update the pointer info in the new
'ZEXTLOAD' with
LN0->getPointerInfo().getWithOffset(PtrOff)
rather than just using the old pointer info?
Regards,
Mikael
More information about the llvm-dev
mailing list