[PATCH] D31512: Allow targets to opt-in to codegen in SCC order

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 23:00:13 PDT 2017


arsenm updated this revision to Diff 93592.
arsenm added a comment.

Fix missing piece


https://reviews.llvm.org/D31512

Files:
  include/llvm/Target/TargetMachine.h
  lib/CodeGen/TargetPassConfig.cpp
  lib/Target/TargetMachine.cpp


Index: lib/Target/TargetMachine.cpp
===================================================================
--- lib/Target/TargetMachine.cpp
+++ lib/Target/TargetMachine.cpp
@@ -44,9 +44,12 @@
                              const TargetOptions &Options)
     : TheTarget(T), DL(DataLayoutString), TargetTriple(TT), TargetCPU(CPU),
       TargetFS(FS), AsmInfo(nullptr), MRI(nullptr), MII(nullptr), STI(nullptr),
-      RequireStructuredCFG(false), DefaultOptions(Options), Options(Options) {
-  if (EnableIPRA.getNumOccurrences())
+      RequireStructuredCFG(false), RequireCodeGenSCCOrder(false),
+      DefaultOptions(Options), Options(Options) {
+  if (EnableIPRA.getNumOccurrences()) {
     this->Options.EnableIPRA = EnableIPRA;
+    RequireCodeGenSCCOrder = true;
+  }
 }
 
 TargetMachine::~TargetMachine() {
Index: lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- lib/CodeGen/TargetPassConfig.cpp
+++ lib/CodeGen/TargetPassConfig.cpp
@@ -534,7 +534,7 @@
   addPreISel();
 
   // Force codegen to run according to the callgraph.
-  if (TM->Options.EnableIPRA)
+  if (TM->requiresCodeGenSCCOrder())
     addPass(new DummyCGSCCPass);
 
   // Add both the safe stack and the stack protection passes: each of them will
Index: include/llvm/Target/TargetMachine.h
===================================================================
--- include/llvm/Target/TargetMachine.h
+++ include/llvm/Target/TargetMachine.h
@@ -89,6 +89,7 @@
   const MCSubtargetInfo *STI;
 
   unsigned RequireStructuredCFG : 1;
+  unsigned RequireCodeGenSCCOrder : 1;
   unsigned O0WantsFastISel : 1;
 
 public:
@@ -158,6 +159,9 @@
   bool requiresStructuredCFG() const { return RequireStructuredCFG; }
   void setRequiresStructuredCFG(bool Value) { RequireStructuredCFG = Value; }
 
+  bool requiresCodeGenSCCOrder() const { return RequireCodeGenSCCOrder; }
+  void setRequiresCodeGenSCCOrder(bool Value) { RequireCodeGenSCCOrder = Value; }
+
   /// Returns the code generation relocation model. The choices are static, PIC,
   /// and dynamic-no-pic, and target default.
   Reloc::Model getRelocationModel() const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31512.93592.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/bdd5764e/attachment.bin>


More information about the llvm-commits mailing list