Skip to content

Commit

Permalink
[X86] Erase dead LEA instruction after converting it to MOV in FixupL…
Browse files Browse the repository at this point in the history
…EAPass::processInstrForSlow3OpLEA.
  • Loading branch information
topperc committed Dec 11, 2019
1 parent 72c68f1 commit 3adc819
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions llvm/lib/Target/X86/X86FixupLEAs.cpp
Expand Up @@ -650,6 +650,9 @@ void FixupLEAPass::processInstrForSlow3OpLEA(MachineBasicBlock::iterator &I,
.addReg(DestReg)
.add(Index);
LLVM_DEBUG(NewMI->dump(););

MBB.erase(I);
I = NewMI;
return;
}

Expand Down
1 change: 0 additions & 1 deletion llvm/test/CodeGen/X86/leaFixup32.mir
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion llvm/test/CodeGen/X86/leaFixup64.mir
Expand Up @@ -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
Expand Down

0 comments on commit 3adc819

Please sign in to comment.