[NVPTX] Move NVPTXPeephole after NVPTXPrologEpilogPass
authorJingyue Wu <jingyue@google.com>
Wed, 1 Jul 2015 20:08:06 +0000 (20:08 +0000)
committerJingyue Wu <jingyue@google.com>
Wed, 1 Jul 2015 20:08:06 +0000 (20:08 +0000)
commit8f2981cb401f5986c681e15dbeb2aa59cdc746af
tree94098a15bcfc6242c6eaa3a439571b33d1d7a68e
parent9215b9ab25969b73a18127d33ce742de3866b738
[NVPTX] Move NVPTXPeephole after NVPTXPrologEpilogPass

Summary:
Offset of frame index is calculated by NVPTXPrologEpilogPass. Before
that the correct offset of stack objects cannot be obtained, which
leads to wrong offset if there are more than 2 frame objects. This patch
move NVPTXPeephole after NVPTXPrologEpilogPass. Because the frame index
is already replaced by %VRFrame in NVPTXPrologEpilogPass, we check
VRFrame register instead, and try to remove the VRFrame if there
is no usage after NVPTXPeephole pass.

Patched by Xuetian Weng.

Test Plan:
Strengthened test/CodeGen/NVPTX/local-stack-frame.ll to check the
offset calculation based on SP and SPL.

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241185 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXPeephole.cpp
lib/Target/NVPTX/NVPTXTargetMachine.cpp
test/CodeGen/NVPTX/local-stack-frame.ll