From 8b0924a130dfc439468e7bddf8add2f6964f9129 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 16 Oct 2013 12:55:08 -0700 Subject: [PATCH] R600: Take alignment into account when calculating stack offset --- lib/Target/R600/AMDGPUFrameLowering.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Target/R600/AMDGPUFrameLowering.cpp b/lib/Target/R600/AMDGPUFrameLowering.cpp index 40f14d2..4f61cfe 100644 --- a/lib/Target/R600/AMDGPUFrameLowering.cpp +++ b/lib/Target/R600/AMDGPUFrameLowering.cpp @@ -79,8 +79,12 @@ int AMDGPUFrameLowering::getFrameIndexOffset(const MachineFunction &MF, for (int i = MFI->getObjectIndexBegin(); i < UpperBound; ++i) { unsigned Size = MFI->getObjectSize(i); + Offset = RoundUpToAlignment(Offset, MFI->getObjectAlignment(i)); Offset += (Size / (getStackWidth(MF) * 4)); } + + if (FI != -1 ) + Offset = RoundUpToAlignment(Offset, MFI->getObjectAlignment(FI)); return Offset; } -- 1.7.11.4