Index: lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp =================================================================== --- lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp +++ lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp @@ -87,18 +87,18 @@ MachineRegisterInfo &MRI = MF.getRegInfo(); const TargetRegisterClass *PtrRC = MRI.getTargetRegisterInfo()->getPointerRegClass(MF); - unsigned SPAddr = MRI.createVirtualRegister(PtrRC); + unsigned Zero = MRI.createVirtualRegister(PtrRC); unsigned Drop = MRI.createVirtualRegister(PtrRC); const auto *TII = MF.getSubtarget().getInstrInfo(); - BuildMI(MBB, InsertAddr, DL, TII->get(WebAssembly::CONST_I32), SPAddr) - .addExternalSymbol(SPSymbol); + BuildMI(MBB, InsertAddr, DL, TII->get(WebAssembly::CONST_I32), Zero) + .addImm(0); auto *MMO = new MachineMemOperand(MachinePointerInfo(MF.getPSVManager() .getExternalSymbolCallEntry(ES)), MachineMemOperand::MOStore, 4, 4); BuildMI(MBB, InsertStore, DL, TII->get(WebAssembly::STORE_I32), Drop) - .addImm(0) - .addReg(SPAddr) + .addExternalSymbol(SPSymbol) + .addReg(Zero) .addImm(2) // p2align .addReg(SrcReg) .addMemOperand(MMO); @@ -137,20 +137,20 @@ const TargetRegisterClass *PtrRC = MRI.getTargetRegisterInfo()->getPointerRegClass(MF); - unsigned SPAddr = MRI.createVirtualRegister(PtrRC); + unsigned Zero = MRI.createVirtualRegister(PtrRC); unsigned SPReg = MRI.createVirtualRegister(PtrRC); const char *ES = "__stack_pointer"; auto *SPSymbol = MF.createExternalSymbolName(ES); - BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), SPAddr) - .addExternalSymbol(SPSymbol); + BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::CONST_I32), Zero) + .addImm(0); auto *LoadMMO = new MachineMemOperand(MachinePointerInfo(MF.getPSVManager() .getExternalSymbolCallEntry(ES)), MachineMemOperand::MOLoad, 4, 4); // Load the SP value. BuildMI(MBB, InsertPt, DL, TII->get(WebAssembly::LOAD_I32), StackSize ? SPReg : (unsigned)WebAssembly::SP32) - .addImm(0) // offset - .addReg(SPAddr) // addr + .addExternalSymbol(SPSymbol) + .addReg(Zero) // addr .addImm(2) // p2align .addMemOperand(LoadMMO);