This is an archive of the discontinued LLVM Phabricator instance.

Process BUNDLE in tail duplication
ClosedPublic

Authored by rampitec on Jan 15 2020, 9:39 AM.

Details

Summary

When tail duplication estimates a size of tail it uses instruction
count. Account for a number of instrictions in a bundle too.

Diff Detail

Event Timeline

rampitec created this revision.Jan 15 2020, 9:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 15 2020, 9:39 AM
arsenm added a subscriber: arsenm.Jan 15 2020, 9:52 AM
arsenm added inline comments.
llvm/lib/CodeGen/TailDuplicator.cpp
628–629

This depends on the target interpretation of a bundle. A VLIW target may want to treat a bundle as 1 instruction

rampitec marked an inline comment as done.Jan 15 2020, 10:02 AM
rampitec added inline comments.
llvm/lib/CodeGen/TailDuplicator.cpp
628–629

VLIW packetizer works much later than this, in addPreEmitPass().

rampitec marked an inline comment as done.Jan 15 2020, 10:09 AM
rampitec added inline comments.
llvm/lib/CodeGen/TailDuplicator.cpp
628–629

Also note that will increase a cost of a bundle, effectively preventing its tail duplication where it would be duplicated earlier. I.e. it will prevent an optimization, so even if there is a target which wants to consider bundle a single instruction it will do no harm, just will not change a source program. I.e. that is a change into a safe direction.

rampitec marked an inline comment as done.Jan 15 2020, 12:59 PM
rampitec added inline comments.
llvm/lib/CodeGen/TailDuplicator.cpp
628–629

In addition the reason to limit tail duplication is code size anyway, and speed is not measured in a number of instructions.

arsenm accepted this revision.Jan 15 2020, 3:41 PM
This revision is now accepted and ready to land.Jan 15 2020, 3:41 PM
This revision was automatically updated to reflect the committed changes.