[llvm] r255563 - [WebAssembly] Avoid adding redundant EXPR_STACK uses.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 14 14:37:23 PST 2015


Author: djg
Date: Mon Dec 14 16:37:23 2015
New Revision: 255563

URL: http://llvm.org/viewvc/llvm-project?rev=255563&view=rev
Log:
[WebAssembly] Avoid adding redundant EXPR_STACK uses.

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp?rev=255563&r1=255562&r2=255563&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp Mon Dec 14 16:37:23 2015
@@ -78,9 +78,10 @@ static void ImposeStackOrdering(MachineI
   ImposeStackInputOrdering(MI);
 
   // Also read the opaque EXPR_STACK register.
-  MI->addOperand(MachineOperand::CreateReg(WebAssembly::EXPR_STACK,
-                                           /*isDef=*/false,
-                                           /*isImp=*/true));
+  if (!MI->readsRegister(WebAssembly::EXPR_STACK))
+    MI->addOperand(MachineOperand::CreateReg(WebAssembly::EXPR_STACK,
+                                             /*isDef=*/false,
+                                             /*isImp=*/true));
 
   // Also, mark any inputs to this instruction as being consumed by an
   // instruction on the expression stack.




More information about the llvm-commits mailing list