diff options
author | Dan Gohman <dan433584@gmail.com> | 2018-09-04 17:46:12 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2018-09-04 17:46:12 +0000 |
commit | 045a217bee40c24a0ad8e20450c3714c74f67b47 (patch) | |
tree | 13757680b83b1209e77c2f5f9be43f550f82a4c3 /llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp | |
parent | 7a474b65791685ddc16d80d0b447691fa6eee165 (diff) | |
download | bcm5719-llvm-045a217bee40c24a0ad8e20450c3714c74f67b47.tar.gz bcm5719-llvm-045a217bee40c24a0ad8e20450c3714c74f67b47.zip |
[WebAssembly] Fix operand rewriting in inline asm lowering.
Use MachineOperand::ChangeToImmediate rather than reassigning
MachineOperands to new values created from MachineOperand::CreateImm,
so that their parent pointers are preserved.
This fixes "Instruction has operand with wrong parent set" errors
reported by the MachineVerifier.
llvm-svn: 341389
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp index c2fcb436f16..7746316e5ba 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp @@ -316,8 +316,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { if (MO.isDef()) { assert(MI.getOpcode() == TargetOpcode::INLINEASM); unsigned LocalId = getLocalId(Reg2Local, CurLocal, OldReg); - MRI.removeRegOperandFromUseList(&MO); - MO = MachineOperand::CreateImm(LocalId); + MO.ChangeToImmediate(LocalId); continue; } @@ -332,8 +331,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { // indices as immediates. if (MI.getOpcode() == TargetOpcode::INLINEASM) { unsigned LocalId = getLocalId(Reg2Local, CurLocal, OldReg); - MRI.removeRegOperandFromUseList(&MO); - MO = MachineOperand::CreateImm(LocalId); + MO.ChangeToImmediate(LocalId); continue; } |