summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
index d890310ac50..0b04a6355a9 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud