diff options
author | Serguei Katkov <serguei.katkov@azul.com> | 2018-01-26 04:49:26 +0000 |
---|---|---|
committer | Serguei Katkov <serguei.katkov@azul.com> | 2018-01-26 04:49:26 +0000 |
commit | 1ce7137c99f944fbcc771733f73280b5e8c4c51c (patch) | |
tree | 54f39d65cb985a0e085a5e38ed68b075825e0a19 /llvm/lib | |
parent | 3a667b9bd8b741f5ac1d8d47857140a3d70737fb (diff) | |
download | bcm5719-llvm-1ce7137c99f944fbcc771733f73280b5e8c4c51c.tar.gz bcm5719-llvm-1ce7137c99f944fbcc771733f73280b5e8c4c51c.zip |
[X86] Fix killed flag handling in X86FixupLea pass
When pass creates a MOV instruction for
lea (%base,%index,1), %dst => mov %base,%dst; add %index,%dst
modification it should clean the killed flag for base
if base is equal to index.
Otherwise verifier complains about usage of killed register in add instruction.
Reviewers: lsaba, zvi, zansari, aaboud
Reviewed By: lsaba
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42522
llvm-svn: 323497
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86FixupLEAs.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86FixupLEAs.cpp b/llvm/lib/Target/X86/X86FixupLEAs.cpp index b41bf99f19b..64678c062ee 100644 --- a/llvm/lib/Target/X86/X86FixupLEAs.cpp +++ b/llvm/lib/Target/X86/X86FixupLEAs.cpp @@ -548,7 +548,8 @@ FixupLEAPass::processInstrForSlow3OpLEA(MachineInstr &MI, // 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 = |