Add NVPTXPeephole pass to reduce unnecessary address cast
authorJingyue Wu <jingyue@google.com>
Wed, 24 Jun 2015 20:20:16 +0000 (20:20 +0000)
committerJingyue Wu <jingyue@google.com>
Wed, 24 Jun 2015 20:20:16 +0000 (20:20 +0000)
commit58f8a138a9db8ef45f1061cc81e9bf2ab541cbb0
tree2a096818e57774c8d4ef2b0bee1a9b5c396165d6
parent8e5b874f1787a9116204ff21c2e429bd07cc4c3b
Add NVPTXPeephole pass to reduce unnecessary address cast

Summary:
This patch first change the register that holds local address for stack
frame to %SPL. Then the new NVPTXPeephole pass will try to scan the
following pattern

   %vreg0<def> = LEA_ADDRi64 <fi#0>, 4
   %vreg1<def> = cvta_to_local %vreg0

and transform it into

   %vreg1<def> = LEA_ADDRi64 %VRFrameLocal, 4

Patched by Xuetian Weng

Test Plan: test/CodeGen/NVPTX/local-stack-frame.ll

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: eliben, jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240587 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/CMakeLists.txt
lib/Target/NVPTX/NVPTX.h
lib/Target/NVPTX/NVPTXFrameLowering.cpp
lib/Target/NVPTX/NVPTXPeephole.cpp [new file with mode: 0644]
lib/Target/NVPTX/NVPTXRegisterInfo.td
lib/Target/NVPTX/NVPTXTargetMachine.cpp
test/CodeGen/NVPTX/call-with-alloca-buffer.ll
test/CodeGen/NVPTX/local-stack-frame.ll