From 003f0f0bad2f0f769a221deebba3e6db69a7b842 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 14 Dec 2015 22:37:23 +0000 Subject: [PATCH] [WebAssembly] Avoid adding redundant EXPR_STACK uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255563 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index d890310ac50..0b04a6355a9 100644 --- a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -78,9 +78,10 @@ static void ImposeStackOrdering(MachineInstr *MI, MachineRegisterInfo &MRI) { 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. -- 2.34.1