OSDN Git Service

[NVPTXFavorNonGenericAddrSpaces] recursively trace into GEP and BitCast
authorJingyue Wu <jingyue@google.com>
Fri, 29 May 2015 17:00:27 +0000 (17:00 +0000)
committerJingyue Wu <jingyue@google.com>
Fri, 29 May 2015 17:00:27 +0000 (17:00 +0000)
commitef056a91119257bc71c1df8b50e4ebd3d0d04c3b
tree74d14ab0c664439db272712ad67cbfc819ac41a7
parented0d841f595d79e338c6cb4500a4faa231670af3
[NVPTXFavorNonGenericAddrSpaces] recursively trace into GEP and BitCast

Summary:
This patch allows NVPTXFavorNonGenericAddrSpaces to remove addrspacecast
from longer chains consisting of GEPs and BitCasts. For example, it can
now optimize

  %0 = addrspacecast [10 x float] addrspace(3)* @a to [10 x float]*
  %1 = gep [10 x float]* %0, i64 0, i64 %i
  %2 = bitcast float* %1 to i32*
  %3 = load i32* %2 ; emits ld.u32

to

  %0 = gep [10 x float] addrspace(3)* @a, i64 0, i64 %i
  %1 = bitcast float addrspace(3)* %0 to i32 addrspace(3)*
  %3 = load i32 addrspace(3)* %1 ; emits ld.shared.f32

Test Plan: @ld_int_from_global_float in access-non-generic.ll

Reviewers: broune, eliben, jholewinski, meheff

Subscribers: jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238574 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
test/CodeGen/NVPTX/access-non-generic.ll