[PATCH] D126754: [MachineSink] Clear kill flags on operands outside loop

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 02:14:20 PDT 2022


critson added a comment.

In D126754#3560211 <https://reviews.llvm.org/D126754#3560211>, @fhahn wrote:

> Could the test case by just a MIR test case that only runs MachineSink?

Yes, I'll do this.



================
Comment at: llvm/lib/CodeGen/MachineSink.cpp:1501-1509
   // Conservatively, clear any kill flags, since it's possible that they are no
   // longer correct.
   // 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())
----------------
MatzeB wrote:
> What about this code that already exists, is it not working for this example? If so, can it be fixed?
`RegsToClearKillFlags` is only populated by `SinkInstruction`, the code path for `SinkIntoCycle` is different.
However I agree this should generally use the same methodology for clearing the flags, so I have changed the code to populate `RegsToClearKillFlags` as part of `SinkIntoCycle` instead of what I initially wrote.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126754/new/

https://reviews.llvm.org/D126754



More information about the llvm-commits mailing list