[PATCH] D17327: [WebAssembly] Disable register stackification and coloring when not optimizing

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 22:33:34 PST 2016


dschuff created this revision.
dschuff added reviewers: jfb, sunfish.
dschuff added a subscriber: llvm-commits.
Herald added subscribers: dschuff, jfb.

These passes are optimizations, and should be disabled when not
optimizing.
Also remove the command line flag for disabling register coloring;
running llc with -O0 should now be useful for debugging, so it's not
necessary.

http://reviews.llvm.org/D17327

Files:
  lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
  lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp

Index: lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -185,11 +185,14 @@
   // Fails with: should be run after register allocation.
   disablePass(&MachineCopyPropagationID);
 
-  // Mark registers as representing wasm's expression stack.
-  addPass(createWebAssemblyRegStackify());
 
-  // Run the register coloring pass to reduce the total number of registers.
-  addPass(createWebAssemblyRegColoring());
+  if (getOptLevel() != CodeGenOpt::None) {
+    // Mark registers as representing wasm's expression stack.
+    addPass(createWebAssemblyRegStackify());
+
+    // Run the register coloring pass to reduce the total number of registers.
+    addPass(createWebAssemblyRegColoring());
+  }
 
   TargetPassConfig::addPostRegAlloc();
 
Index: lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
===================================================================
--- lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
+++ lib/Target/WebAssembly/WebAssemblyRegColoring.cpp
@@ -29,10 +29,6 @@
 
 #define DEBUG_TYPE "wasm-reg-coloring"
 
-static cl::opt<bool>
-    DisableRegColoring("disable-wasm-reg-coloring", cl::Hidden, cl::init(false),
-                       cl::desc("Disable WebAssembly register coloring"));
-
 namespace {
 class WebAssemblyRegColoring final : public MachineFunctionPass {
 public:
@@ -80,9 +76,6 @@
            << "********** Function: " << MF.getName() << '\n';
   });
 
-  if (DisableRegColoring)
-    return false;
-
   // If there are calls to setjmp or sigsetjmp, don't perform coloring. Virtual
   // registers could be modified before the longjmp is executed, resulting in
   // the wrong value being used afterwards. (See <rdar://problem/8007500>.)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17327.48151.patch
Type: text/x-patch
Size: 1869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160217/ab1b52b3/attachment.bin>


More information about the llvm-commits mailing list