Skip to content

Commit

Permalink
AMDGPU: Fix mishandling alignment when scalarizing vector loads/stores
Browse files Browse the repository at this point in the history
I don't think this was causing any real problems, so I'm not sure
how to test for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260646 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
arsenm committed Feb 12, 2016
1 parent 85b3e06 commit 197cdba
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Target/AMDGPU/AMDGPUISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,9 @@ SDValue AMDGPUTargetLowering::ScalarizeVectorLoad(const SDValue Op,
SmallVector<SDValue, 8> Chains;

SDLoc SL(Op);
unsigned BaseAlign = Load->getAlignment();
unsigned MemEltSize = MemEltVT.getStoreSize();

MachinePointerInfo SrcValue(Load->getMemOperand()->getValue());

for (unsigned i = 0; i < NumElts; ++i) {
Expand All @@ -1073,7 +1075,7 @@ SDValue AMDGPUTargetLowering::ScalarizeVectorLoad(const SDValue Op,
Load->getChain(), Ptr,
SrcValue.getWithOffset(i * MemEltSize),
MemEltVT, Load->isVolatile(), Load->isNonTemporal(),
Load->isInvariant(), Load->getAlignment());
Load->isInvariant(), MinAlign(BaseAlign, i * MemEltSize));
Loads.push_back(NewLoad.getValue(0));
Chains.push_back(NewLoad.getValue(1));
}
Expand Down Expand Up @@ -1212,6 +1214,7 @@ SDValue AMDGPUTargetLowering::ScalarizeVectorStore(SDValue Op,

SmallVector<SDValue, 8> Chains;

unsigned BaseAlign = Store->getAlignment();
unsigned EltSize = MemEltVT.getStoreSize();
MachinePointerInfo SrcValue(Store->getMemOperand()->getValue());

Expand All @@ -1226,7 +1229,7 @@ SDValue AMDGPUTargetLowering::ScalarizeVectorStore(SDValue Op,
DAG.getTruncStore(Store->getChain(), SL, Val, Ptr,
SrcValue.getWithOffset(i * EltSize),
MemEltVT, Store->isNonTemporal(), Store->isVolatile(),
Store->getAlignment());
MinAlign(BaseAlign, i * EltSize));
Chains.push_back(NewStore);
}

Expand Down

0 comments on commit 197cdba

Please sign in to comment.