This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][Localizer] Allow localization of G_INTTOPTR and chains of instructions
ClosedPublic

Authored by aemerson on Jun 20 2019, 4:22 PM.

Details

Summary

G_INTTOPTR can prevent the localizer from moving G_CONSTANTs, but since it's essentially a side effect free cast instruction we can remat both instructions. This patch changes the localizer to enable localization of the chains by iterating over the entry block instructions in reverse order. That way, uses will localized first, and then the defs are free to be localized as well.

This also changes the previous SmallPtrSet of localized instructions to use a SetVector instead. We're dealing with pointers and need deterministic iteration order.

Overall, this change improves ARM64 -O0 CTMark code size by around 0.7% geomean.

Diff Detail

Event Timeline

aemerson created this revision.Jun 20 2019, 4:22 PM
paquette accepted this revision.Jun 20 2019, 4:42 PM

Seems reasonable, LGTM.

This revision is now accepted and ready to land.Jun 20 2019, 4:42 PM
This revision was automatically updated to reflect the committed changes.