This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Allow CSE of G_IMPLICIT_DEF
ClosedPublic

Authored by arsenm on Feb 3 2020, 8:16 PM.

Details

Summary

The legalizer produces a lot of these, and they make reading legalized
MIR annoying. For some reason, this does seem to sometimes introduce
copies of implicit def, which is dumb.

Diff Detail

Event Timeline

arsenm created this revision.Feb 3 2020, 8:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2020, 8:16 PM
aditya_nandakumar accepted this revision.Feb 3 2020, 8:49 PM
This revision is now accepted and ready to land.Feb 3 2020, 8:49 PM

Could this pessimize code generation? If you have multiple G_IMPLICIT_DEFs, you can push them down close to their respective user and just have different undef register sources in each of those places.

With CSE'd G_IMPLICIT_DEF, they all end up using the same value, i.e. we potentially end up having to keep a register alive over a long interval.

arsenm added a comment.Feb 5 2020, 5:41 AM

Could this pessimize code generation? If you have multiple G_IMPLICIT_DEFs, you can push them down close to their respective user and just have different undef register sources in each of those places.

With CSE'd G_IMPLICIT_DEF, they all end up using the same value, i.e. we potentially end up having to keep a register alive over a long interval.

Before scheduling/RA, these are all erased and the use instructions see a register with the undef flag so liveness shouldn't be a concern. There are a number of places where the instruction count matters, and I would expect this to help since it reduces that