This is an archive of the discontinued LLVM Phabricator instance.

[MachineOutliner] Adding aggressive tail call outlining options.
AbandonedPublic

Authored by plotfi on May 6 2020, 8:41 AM.

Details

Summary

This diff introduces an option -aggressive-tail-call-outlining to run the MachineOutliner twice: Once in a special only-tail-calls mode, and then again in its regular mode. There is also an option -aggressive-tail-call-outlining-only to be used for debugging that tells the outliner to bail after outlining just the tail calls.

In the only-tail-calls mode, the limitations on W30 are ignored, resulting in a different suffix tree with longer matches, which are then processed for tail calls only. This has a slight improvement over the newer CFI outlining strategy alone (by one or two instructions).

Diff Detail

Event Timeline

plotfi created this revision.May 6 2020, 8:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2020, 8:41 AM
paquette added a comment.EditedMay 6 2020, 9:51 AM

I'm a little concerned about putting this in the generic outlining algorithm, because not every target's outliner necessarily supports tail calls.

For example, the x86 outliner doesn't support tail calls right now. I would expect that in that case we should get a warning or some debug output. I can imagine someone enabling this and then being surprised when it does nothing.

I'm not opposed to this otherwise. In general, I'd like to keep potentially target-specific things outside of the generic outlining algorithm, even if those things are pretty widespread.

Also, do you think that you could build CTMark for AArch64 at -Oz with + without this change? It would be nice to see what kind of code size savings this gives us.

llvm/lib/CodeGen/MachineOutliner.cpp
115–117

More succinct:

"Only outline tail calls. Meant for testing purposes. (default = off)"

661

Why is "Tail Call Only" capitalized?

I think this could be more descriptive anyway.

E.g.

"If true, only outline tail calls. If false, outline all types of frames."

1131–1132

Why not do this as a comment on the outlined function name?

1512

It's weird to me that you can have

AggressiveTailCallOutlining == false
AggressiveTailCallOutliningOnly == true

Intuitively, I would assume that AggressiveTailCallOutliningOnly implies AggressiveTailCallOutlining.

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
6259

Earlier, you called this "Only Tail Calls mode". This should be consistent across the board to make grepping the source easier.

plotfi abandoned this revision.Jul 14 2020, 9:39 PM

Abandoning. I think the stuff @AndrewLitteken added a few months ago is more than sufficient.