[llvm] r303800 - [AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 12:55:49 PDT 2017
Author: niravd
Date: Wed May 24 14:55:49 2017
New Revision: 303800
URL: http://llvm.org/viewvc/llvm-project?rev=303800&view=rev
Log:
[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC
In preparation for late-stage store merging.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp?rev=303800&r1=303799&r2=303800&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64ISelLowering.cpp Wed May 24 14:55:49 2017
@@ -9222,16 +9222,26 @@ static SDValue splitStoreSplat(Selection
// instructions (stp).
SDLoc DL(&St);
SDValue BasePtr = St.getBasePtr();
+ int64_t BaseOffset = 0;
+
const MachinePointerInfo &PtrInfo = St.getPointerInfo();
SDValue NewST1 =
DAG.getStore(St.getChain(), DL, SplatVal, BasePtr, PtrInfo,
OrigAlignment, St.getMemOperand()->getFlags());
+ // As this in ISel, we will not merge this add which may degrate results.
+ if (BasePtr->getOpcode() == ISD::ADD &&
+ isa<ConstantSDNode>(BasePtr->getOperand(1))) {
+ BaseOffset = cast<ConstantSDNode>(BasePtr->getOperand(1))->getSExtValue();
+ BasePtr = BasePtr->getOperand(0);
+ }
+
unsigned Offset = EltOffset;
while (--NumVecElts) {
unsigned Alignment = MinAlign(OrigAlignment, Offset);
- SDValue OffsetPtr = DAG.getNode(ISD::ADD, DL, MVT::i64, BasePtr,
- DAG.getConstant(Offset, DL, MVT::i64));
+ SDValue OffsetPtr = DAG.getNode(
+ ISD::ADD, DL, MVT::i64, BasePtr,
+ DAG.getConstant(BaseOffset + ((int64_t)Offset), DL, MVT::i64));
NewST1 = DAG.getStore(NewST1.getValue(0), DL, SplatVal, OffsetPtr,
PtrInfo.getWithOffset(Offset), Alignment,
St.getMemOperand()->getFlags());
More information about the llvm-commits
mailing list