diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-08 17:54:32 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-08 17:54:32 +0000 |
commit | 85b1c48b209ed21e6f7bddc2955706648aeb75ae (patch) | |
tree | 1ee37b44bbe274a035921d6a4391521fee6b01dc /llvm/lib/CodeGen | |
parent | ff5064a18888dc3628046f75d82262f254a43ea3 (diff) | |
download | bcm5719-llvm-85b1c48b209ed21e6f7bddc2955706648aeb75ae.tar.gz bcm5719-llvm-85b1c48b209ed21e6f7bddc2955706648aeb75ae.zip |
Clear kill flags on all used registers when sinking instructions.
The test here was sinking the AND here to a lower BB:
%vreg7<def> = ANDWri %vreg8, 0; GPR32common:%vreg7,%vreg8
TBNZW %vreg8<kill>, 0, <BB#1>; GPR32common:%vreg8
which meant that vreg8 was read after it was killed.
This commit changes the code from clearing kill flags on the AND to clearing flags on all registers used by the AND.
llvm-svn: 236886
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/MachineSink.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp index 58a9bbdb357..90ca25a6cef 100644 --- a/llvm/lib/CodeGen/MachineSink.cpp +++ b/llvm/lib/CodeGen/MachineSink.cpp @@ -756,7 +756,13 @@ bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) { // Conservatively, clear any kill flags, since it's possible that they are no // longer correct. - MI->clearKillInfo(); + // Note that we have to clear the kill flags for any register this instruction + // uses as we may sink over another instruction which currently kills the + // used registers. + for (MachineOperand &MO : MI->operands()) { + if (MO.isReg() && MO.isUse()) + MRI->clearKillFlags(MO.getReg()); + } return true; } |