AMDGPU: Fix off-by-one in SIRegisterInfo::eliminateFrameIndex
authorNicolai Haehnle <nhaehnle@gmail.com>
Thu, 17 Dec 2015 16:46:42 +0000 (16:46 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Thu, 17 Dec 2015 16:46:42 +0000 (16:46 +0000)
commit7c502030bf075f11afe020ef11236ae417af7474
treed87ac90b3c5794f46f25a2e23175e4e22073b85a
parent02fd5dfa7c48314f0cdfc98f1b7efaa25693f052
AMDGPU: Fix off-by-one in SIRegisterInfo::eliminateFrameIndex

Summary:
The method insertNOPs expected the number of wait states to be passed as
parameter, while eliminateFrameIndex passed the immediate argument for the
S_NOP, leading to an off-by-one error. Rename the method to make the
meaning of its parameter clearer. The number of 4 / 5 wait states (which
is what the method has always _tried_ to do according to the comment) is
correct according to the hardware docs.

I stumbled upon this while trying to track down the cause of
https://bugs.freedesktop.org/show_bug.cgi?id=93264. While clearly needed,
this patch unfortunately does not fix that bug...

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits

Differential Revision: http://reviews.llvm.org/D15542

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255906 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIInstrInfo.cpp
lib/Target/AMDGPU/SIInstrInfo.h
lib/Target/AMDGPU/SIRegisterInfo.cpp