This is an archive of the discontinued LLVM Phabricator instance.

MachineInstr: Respect register aliases in clearRegiserKills()
ClosedPublic

Authored by MatzeB on Feb 23 2016, 3:56 PM.

Details

Summary

This fixes bugs in copy elimination code in llvm. It slightly changes the
semantics of clearRegisterKills(). This is appropriate because:

  • Users in lib/CodeGen/MachineCopyPropagation.cpp and lib/Target/AArch64RedundantCopyElimination.cpp and lib/Target/SystemZ/SystemZElimCompare.cpp are incorrect without it (see included testcase).
  • All other users in llvm are unaffected (they pass TRI==nullptr)
  • Kill flags are optional anyway.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB updated this revision to Diff 48854.Feb 23 2016, 3:56 PM
MatzeB retitled this revision from to MachineInstr: Respect register aliases in clearRegiserKills().
MatzeB updated this object.
MatzeB added reviewers: qcolombet, junbuml.
MatzeB set the repository for this revision to rL LLVM.
MatzeB added a subscriber: llvm-commits.
qcolombet accepted this revision.Feb 23 2016, 6:03 PM
qcolombet edited edge metadata.

Hi Matthias,

LGTM.

Thanks,
Q.

test/CodeGen/X86/machine-copy-prop.mir
10 ↗(On Diff #48854)

Typo -> redundant.

This revision is now accepted and ready to land.Feb 23 2016, 6:03 PM
This revision was automatically updated to reflect the committed changes.
mcrosier added inline comments.Feb 24 2016, 12:19 PM
llvm/trunk/lib/CodeGen/MachineInstr.cpp
1970

As a compile-time optimization, would it make sense to perform the Reg == OpReg check before making the call to regsOverlap?