[PATCH] D19518: Add optimization bisect opt-in calls for NVPTX passes
Andy Kaylor via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 25 18:09:18 PDT 2016
andrew.w.kaylor created this revision.
andrew.w.kaylor added a reviewer: jholewinski.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.
Herald added a subscriber: jholewinski.
This patch adds calls to NVPTX-specific passes that can be safely skipped to opt-in to the optimization bisect mechanism.
I selected the passes to be skipped based on the fact that they were not added at CodeGenOpt::None in NVPTXTargetMachine.cpp. Based on that criteria, I did not add opt-in calls to the following passes, which appear to be required:
GenericToNVVM
NVPTXAllocaHoisting
NVPTXAssignValidGlobalNames
NVPTXLowerAggrCopies
NVPTXPeephole
NVPTXPrologEpilogPass
NVVMReflect
NVPTXReplaceImageHandles
Based on the description (not to mention the name) NVPTXPeephole seemed to me as if it could be safely skipped but it appears that it never is, so I did not add the opt-in call there.
Note that the call to skipFunction() will also check for the "optnone" function attribute, so this can theoretically result in passes being skipped even when optimization bisect is not being done. However, I believe that any pass that can be safely skipped should be skipped for functions with the optnone attribute.
See D19172 for details on the base optimizaton bisect implementation.
Repository:
rL LLVM
http://reviews.llvm.org/D19518
Files:
lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
lib/Target/NVPTX/NVPTXImageOptimizer.cpp
lib/Target/NVPTX/NVPTXInferAddressSpaces.cpp
lib/Target/NVPTX/NVPTXLowerAlloca.cpp
lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
Index: lib/Target/NVPTX/NVPTXImageOptimizer.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXImageOptimizer.cpp
+++ lib/Target/NVPTX/NVPTXImageOptimizer.cpp
@@ -50,6 +50,9 @@
: FunctionPass(ID) {}
bool NVPTXImageOptimizer::runOnFunction(Function &F) {
+ if (skipFunction(F))
+ return false;
+
bool Changed = false;
InstrToDelete.clear();
Index: lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
+++ lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp
@@ -266,7 +266,7 @@
}
bool NVPTXFavorNonGenericAddrSpaces::runOnFunction(Function &F) {
- if (DisableFavorNonGeneric)
+ if (DisableFavorNonGeneric || skipFunction(F))
return false;
bool Changed = false;
Index: lib/Target/NVPTX/NVPTXLowerAlloca.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXLowerAlloca.cpp
+++ lib/Target/NVPTX/NVPTXLowerAlloca.cpp
@@ -62,6 +62,9 @@
// Main function for this pass.
// =============================================================================
bool NVPTXLowerAlloca::runOnBasicBlock(BasicBlock &BB) {
+ if (skipBasicBlock(BB))
+ return false;
+
bool Changed = false;
for (auto &I : BB) {
if (auto allocaInst = dyn_cast<AllocaInst>(&I)) {
Index: lib/Target/NVPTX/NVPTXInferAddressSpaces.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXInferAddressSpaces.cpp
+++ lib/Target/NVPTX/NVPTXInferAddressSpaces.cpp
@@ -419,6 +419,9 @@
}
bool NVPTXInferAddressSpaces::runOnFunction(Function &F) {
+ if (skipFunction(F))
+ return false;
+
// Collects all generic address expressions in postorder.
std::vector<Value *> Postorder = collectGenericAddressExpressions(F);
Index: lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
+++ lib/Target/NVPTX/NVPTXLowerKernelArgs.cpp
@@ -193,6 +193,9 @@
// Main function for this pass.
// =============================================================================
bool NVPTXLowerKernelArgs::runOnFunction(Function &F) {
+ if (skipFunction(F))
+ return false;
+
// Skip non-kernels. See the comments at the top of this file.
if (!isKernelFunction(F))
return false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19518.54957.patch
Type: text/x-patch
Size: 2447 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/ae5b2e59/attachment.bin>
More information about the llvm-commits
mailing list