Skip to content

Commit 1375560

Browse files
author
Jingyue Wu
committedMar 20, 2016
[NVPTX] Adds a new address space inference pass.
Summary: The old address space inference pass (NVPTXFavorNonGenericAddrSpaces) is unable to convert the address space of a pointer induction variable. This patch adds a new pass called NVPTXInferAddressSpaces that overcomes that limitation using a fixed-point data-flow analysis (see the file header comments for details). The new pass is experimental and not enabled by default. Users can turn it on by setting the -nvptx-use-infer-addrspace flag of llc. Reviewers: jholewinski, tra, jlebar Subscribers: jholewinski, llvm-commits Differential Revision: http://reviews.llvm.org/D17965 llvm-svn: 263916
1 parent 6fa3e59 commit 1375560

File tree

6 files changed

+678
-19
lines changed

6 files changed

+678
-19
lines changed
 

‎llvm/lib/Target/NVPTX/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ set(NVPTXCodeGen_sources
1818
NVPTXISelDAGToDAG.cpp
1919
NVPTXISelLowering.cpp
2020
NVPTXImageOptimizer.cpp
21+
NVPTXInferAddressSpaces.cpp
2122
NVPTXInstrInfo.cpp
2223
NVPTXLowerAggrCopies.cpp
2324
NVPTXLowerKernelArgs.cpp

‎llvm/lib/Target/NVPTX/NVPTX.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ FunctionPass *createNVPTXISelDag(NVPTXTargetMachine &TM,
4646
ModulePass *createNVPTXAssignValidGlobalNamesPass();
4747
ModulePass *createGenericToNVVMPass();
4848
FunctionPass *createNVPTXFavorNonGenericAddrSpacesPass();
49+
FunctionPass *createNVPTXInferAddressSpacesPass();
4950
ModulePass *createNVVMReflectPass();
5051
ModulePass *createNVVMReflectPass(const StringMap<int>& Mapping);
5152
MachineFunctionPass *createNVPTXPrologEpilogPass();

‎llvm/lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
//
88
//===----------------------------------------------------------------------===//
99
//
10+
// FIXME: This pass is deprecated in favor of NVPTXInferAddressSpaces, which
11+
// uses a new algorithm that handles pointer induction variables.
12+
//
1013
// When a load/store accesses the generic address space, checks whether the
1114
// address is casted from a non-generic address space. If so, remove this
1215
// addrspacecast because accessing non-generic address spaces is typically
@@ -164,8 +167,8 @@ Value *NVPTXFavorNonGenericAddrSpaces::hoistAddrSpaceCastFromGEP(
164167
GEP->getSourceElementType(), Cast->getOperand(0), Indices,
165168
"", GEPI);
166169
NewGEP->setIsInBounds(GEP->isInBounds());
170+
NewGEP->takeName(GEP);
167171
NewASC = new AddrSpaceCastInst(NewGEP, GEP->getType(), "", GEPI);
168-
NewASC->takeName(GEP);
169172
// Without RAUWing GEP, the compiler would visit GEP again and emit
170173
// redundant instructions. This is exercised in test @rauw in
171174
// access-non-generic.ll.

0 commit comments

Comments
 (0)