This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][Localizer] Don't localize phi operands which are used more than once in the phi.
ClosedPublic

Authored by aemerson on Jan 25 2021, 4:05 PM.

Details

Summary

The current algorithm just tries to localize defs as far as they can go, and in the case of G_PHI operands, it clones the def into the predecessor block for each incoming edge. When multiple edges have the same register value, this can cause unnecessary code bloat, and inhibit later optimizations.

This change checks if a given phi operand is unique in the phi, if not the def of that register is not localized to the predecessor.

Diff Detail

Event Timeline

aemerson created this revision.Jan 25 2021, 4:05 PM
aemerson requested review of this revision.Jan 25 2021, 4:05 PM
arsenm accepted this revision.Jan 25 2021, 5:27 PM
This revision is now accepted and ready to land.Jan 25 2021, 5:27 PM