Index: lib/Target/X86/X86FixupLEAs.cpp =================================================================== --- lib/Target/X86/X86FixupLEAs.cpp +++ lib/Target/X86/X86FixupLEAs.cpp @@ -548,7 +548,8 @@ // lea (%base,%index,1), %dst => mov %base,%dst; add %index,%dst if (IsScale1 && !hasLEAOffset(Offset)) { - TII->copyPhysReg(*MFI, MI, DL, DstR, BaseR, Base.isKill()); + bool BIK = Base.isKill() && BaseR != IndexR; + TII->copyPhysReg(*MFI, MI, DL, DstR, BaseR, BIK); DEBUG(MI.getPrevNode()->dump();); MachineInstr *NewMI = Index: test/CodeGen/X86/leaFixup32.mir =================================================================== --- test/CodeGen/X86/leaFixup32.mir +++ test/CodeGen/X86/leaFixup32.mir @@ -354,7 +354,7 @@ ; CHECK: %ebx = MOV32rr %ebp ; CHECK: %ebx = ADD32rr %ebx, %ebp - %ebx = LEA32r %ebp, 1, %ebp, 0, %noreg + %ebx = LEA32r killed %ebp, 1, %ebp, 0, %noreg RETQ %ebx ... Index: test/CodeGen/X86/leaFixup64.mir =================================================================== --- test/CodeGen/X86/leaFixup64.mir +++ test/CodeGen/X86/leaFixup64.mir @@ -810,7 +810,7 @@ ; CHECK: %rbx = MOV64rr %rbp ; CHECK: %rbx = ADD64rr %rbx, %rbp - %rbx = LEA64r %rbp, 1, %rbp, 0, %noreg + %rbx = LEA64r killed %rbp, 1, %rbp, 0, %noreg RETQ %ebx ...