mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
[ARM] Re-re-apply VLD1/VST1 base-update combine.
This re-applies r223862, r224198, r224203, and r224754, which were reverted in r228129 because they exposed Clang misalignment problems when self-hosting. The combine caused the crashes because we turned ISD::LOAD/STORE nodes to ARMISD::VLD1/VST1_UPD nodes. When selecting addressing modes, we were very lax for the former, and only emitted the alignment operand (as in "[r1:128]") when it was larger than the standard alignment of the memory type. However, for ARMISD nodes, we just used the MMO alignment, no matter what. In our case, we turned ISD nodes to ARMISD nodes, and this caused the alignment operands to start being emitted. And that's how we exposed alignment problems that were ignored before (but I believe would have been caught with SCTRL.A==1?). To fix this, we can just mirror the hack done for ISD nodes: only take into account the MMO alignment when the access is overaligned. Original commit message: We used to only combine intrinsics, and turn them into VLD1_UPD/VST1_UPD when the base pointer is incremented after the load/store. We can do the same thing for generic load/stores. Note that we can only combine the first load/store+adds pair in a sequence (as might be generated for a v16f32 load for instance), because other combines turn the base pointer addition chain (each computing the address of the next load, from the address of the last load) into independent additions (common base pointer + this load's offset). rdar://19717869, rdar://14062261. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229932 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -992,18 +992,24 @@ bool ARMDAGToDAGISel::SelectAddrMode6(SDNode *Parent, SDValue N, SDValue &Addr,
|
||||
Addr = N;
|
||||
|
||||
unsigned Alignment = 0;
|
||||
if (LSBaseSDNode *LSN = dyn_cast<LSBaseSDNode>(Parent)) {
|
||||
|
||||
MemSDNode *MemN = cast<MemSDNode>(Parent);
|
||||
|
||||
if (isa<LSBaseSDNode>(MemN) ||
|
||||
((MemN->getOpcode() == ARMISD::VST1_UPD ||
|
||||
MemN->getOpcode() == ARMISD::VLD1_UPD) &&
|
||||
MemN->getConstantOperandVal(MemN->getNumOperands() - 1) == 1)) {
|
||||
// This case occurs only for VLD1-lane/dup and VST1-lane instructions.
|
||||
// The maximum alignment is equal to the memory size being referenced.
|
||||
unsigned LSNAlign = LSN->getAlignment();
|
||||
unsigned MemSize = LSN->getMemoryVT().getSizeInBits() / 8;
|
||||
if (LSNAlign >= MemSize && MemSize > 1)
|
||||
unsigned MMOAlign = MemN->getAlignment();
|
||||
unsigned MemSize = MemN->getMemoryVT().getSizeInBits() / 8;
|
||||
if (MMOAlign >= MemSize && MemSize > 1)
|
||||
Alignment = MemSize;
|
||||
} else {
|
||||
// All other uses of addrmode6 are for intrinsics. For now just record
|
||||
// the raw alignment value; it will be refined later based on the legal
|
||||
// alignment operands for the intrinsic.
|
||||
Alignment = cast<MemIntrinsicSDNode>(Parent)->getAlignment();
|
||||
Alignment = MemN->getAlignment();
|
||||
}
|
||||
|
||||
Align = CurDAG->getTargetConstant(Alignment, MVT::i32);
|
||||
|
Reference in New Issue
Block a user