This is an archive of the discontinued LLVM Phabricator instance.

Preserve existing registers when adding pristines to LivePhysRegs
ClosedPublic

Authored by kparzysz on Sep 7 2017, 4:10 PM.

Details

Summary

If a non-pristine, callee-saved register is already present in LivePhysRegs, calling addPristines would cause it to be removed. Make sure that the existing contents of LivePhysRegs are preserved.

Diff Detail

Repository
rL LLVM

Event Timeline

kparzysz created this revision.Sep 7 2017, 4:10 PM
MatzeB edited edge metadata.Sep 7 2017, 4:30 PM

When I wrote this I assumed that addLiveOuts()/addLiveIns() is only called on empty sets looks like I didn't add an assert() for that and ifconversion does indeed call it no non-empty sets now. Thanks for tracking this down!

  • Can you maintain an optimized code path that avoids the creation of an extra LivePhysRegs instance in the common case where the set is empty?
  • We probably want the same fix (or an assert(empty())) in LiveRegUnits as well.
kparzysz updated this revision to Diff 114364.Sep 8 2017, 7:57 AM
  • Kept the original code for the case of empty set.
  • Added the same fix to LiveRegUnits.
MatzeB accepted this revision.Sep 8 2017, 9:16 AM

LGTM, thanks

include/llvm/CodeGen/LiveRegUnits.h
54 ↗(On Diff #114364)

Good catch

This revision is now accepted and ready to land.Sep 8 2017, 9:16 AM
This revision was automatically updated to reflect the committed changes.