diff --git a/llvm/lib/Target/X86/X86FixupLEAs.cpp b/llvm/lib/Target/X86/X86FixupLEAs.cpp index 46cb467485c4..9ac401bb0253 100644 --- a/llvm/lib/Target/X86/X86FixupLEAs.cpp +++ b/llvm/lib/Target/X86/X86FixupLEAs.cpp @@ -650,6 +650,9 @@ void FixupLEAPass::processInstrForSlow3OpLEA(MachineBasicBlock::iterator &I, .addReg(DestReg) .add(Index); LLVM_DEBUG(NewMI->dump();); + + MBB.erase(I); + I = NewMI; return; } diff --git a/llvm/test/CodeGen/X86/leaFixup32.mir b/llvm/test/CodeGen/X86/leaFixup32.mir index 23f3d7616966..9fe5b190c154 100644 --- a/llvm/test/CodeGen/X86/leaFixup32.mir +++ b/llvm/test/CodeGen/X86/leaFixup32.mir @@ -378,7 +378,6 @@ body: | ; CHECK: liveins: $eax, $ebp, $ebx ; CHECK: $ebx = MOV32rr $ebp ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags - ; CHECK: $ebx = LEA32r killed $ebp, 1, $ebp, 0, $noreg ; CHECK: RETQ $ebx $ebx = LEA32r killed $ebp, 1, $ebp, 0, $noreg RETQ $ebx diff --git a/llvm/test/CodeGen/X86/leaFixup64.mir b/llvm/test/CodeGen/X86/leaFixup64.mir index 673d43ea71a1..7fdf582055c2 100644 --- a/llvm/test/CodeGen/X86/leaFixup64.mir +++ b/llvm/test/CodeGen/X86/leaFixup64.mir @@ -873,7 +873,6 @@ body: | ; CHECK: liveins: $rax, $rbp, $rbx ; CHECK: $rbx = MOV64rr $rbp ; CHECK: $rbx = ADD64rr $rbx, $rbp, implicit-def $eflags - ; CHECK: $rbx = LEA64r killed $rbp, 1, $rbp, 0, $noreg ; CHECK: RETQ $ebx $rbx = LEA64r killed $rbp, 1, $rbp, 0, $noreg RETQ $ebx