[PATCH] D45070: [NVPTX] Enable StructuredCFG for NVPTX

Tim Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 16:45:40 PDT 2018


timshen created this revision.
timshen added a reviewer: jlebar.
Herald added subscribers: hiraditya, sanjoy, jholewinski.

Make NVPTX require structured CFG. Added a temporary flag to
"roll back" the behavior for easy deployment.

Combined with https://reviews.llvm.org/D45008, this fixes several internal Nvidia GPU test
failures that we suspect to be ptxas miscompiles (PR27738).


https://reviews.llvm.org/D45070

Files:
  llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp


Index: llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -44,6 +44,14 @@
                                cl::desc("Disable load/store vectorizer"),
                                cl::init(false), cl::Hidden);
 
+// TODO: Remove this flag when we are confident with no regressions.
+static cl::opt<bool> DisableRequireStructuredCFG(
+    "disable-nvptx-require-structured-cfg",
+    cl::desc("Transitional flag to turn off NVPTX's requirement on preserving "
+             "structured CFG. The requirement should be disabled only when "
+             "unexpected regressions happen."),
+    cl::init(false), cl::Hidden);
+
 namespace llvm {
 
 void initializeNVVMIntrRangePass(PassRegistry&);
@@ -108,6 +116,8 @@
     drvInterface = NVPTX::NVCL;
   else
     drvInterface = NVPTX::CUDA;
+  if (!DisableRequireStructuredCFG)
+    setRequiresStructuredCFG(true);
   initAsmInfo();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45070.140366.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180329/c433a705/attachment.bin>


More information about the llvm-commits mailing list