[llvm] r260646 - AMDGPU: Fix mishandling alignment when scalarizing vector loads/stores

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 18:22:21 PST 2016


Author: arsenm
Date: Thu Feb 11 20:22:21 2016
New Revision: 260646

URL: http://llvm.org/viewvc/llvm-project?rev=260646&view=rev
Log:
AMDGPU: Fix mishandling alignment when scalarizing vector loads/stores

I don't think this was causing any real problems, so I'm not sure
how to test for this.

Modified:
    llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp?rev=260646&r1=260645&r2=260646&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUISelLowering.cpp Thu Feb 11 20:22:21 2016
@@ -1061,7 +1061,9 @@ SDValue AMDGPUTargetLowering::ScalarizeV
   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) {
@@ -1073,7 +1075,7 @@ SDValue AMDGPUTargetLowering::ScalarizeV
                        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));
   }
@@ -1212,6 +1214,7 @@ SDValue AMDGPUTargetLowering::ScalarizeV
 
   SmallVector<SDValue, 8> Chains;
 
+  unsigned BaseAlign = Store->getAlignment();
   unsigned EltSize = MemEltVT.getStoreSize();
   MachinePointerInfo SrcValue(Store->getMemOperand()->getValue());
 
@@ -1226,7 +1229,7 @@ SDValue AMDGPUTargetLowering::ScalarizeV
       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);
   }
 




More information about the llvm-commits mailing list