[PATCH] D11663: [NVPTX] Added an option to run NVVMReflect pass.
Artem Belevich via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 14:46:39 PDT 2015
tra updated this revision to Diff 33001.
tra added a comment.
Added test case to verify that nvptx-enable-reflect option works.
http://reviews.llvm.org/D11663
Files:
lib/Target/NVPTX/NVPTXTargetMachine.cpp
test/CodeGen/NVPTX/nvptx-enable-reflect.ll
Index: test/CodeGen/NVPTX/nvptx-enable-reflect.ll
===================================================================
--- /dev/null
+++ test/CodeGen/NVPTX/nvptx-enable-reflect.ll
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=nvptx -debug-pass=Structure -o /dev/null 2>&1 \
+; RUN: | FileCheck %s --check-prefix=ALL --check-prefix=NOREFLECT
+; RUN: llc < %s -march=nvptx -debug-pass=Structure -o /dev/null -nvptx-enable-reflect 2>&1 \
+; RUN: | FileCheck %s --check-prefix=ALL --check-prefix=REFLECT
+
+; ALL: Pass Arguments
+; ALL: ModulePass Manager
+; REFLECT-NEXT: Replace occurrences of __nvvm_reflect
+; NOREFLECT-NOT: Replace occurrences of __nvvm_reflect
+; ALL-NEXT: FunctionPass Manager
Index: lib/Target/NVPTX/NVPTXTargetMachine.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -76,6 +76,11 @@
initializeNVPTXLowerAggrCopiesPass(PR);
}
+static cl::opt<bool> NVPTXEnableReflect(
+ "nvptx-enable-reflect", cl::init(false), cl::Hidden,
+ cl::desc("Run NVVM reflection pass before other standard passes, "
+ "disabled by default"));
+
static std::string computeDataLayout(bool is64Bit) {
std::string Ret = "e";
@@ -176,6 +181,8 @@
disablePass(&MachineCopyPropagationID);
disablePass(&TailDuplicateID);
+ if (NVPTXEnableReflect)
+ addPass(createNVVMReflectPass());
addPass(createNVPTXImageOptimizerPass());
addPass(createNVPTXAssignValidGlobalNamesPass());
addPass(createGenericToNVVMPass());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11663.33001.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150824/b8f22866/attachment.bin>
More information about the llvm-commits
mailing list