Major changes:
This commit adds tail-call support to the outliner. This works by making terminators/returns legal to outline if they are either already tail-calls, or they're the last instruction in a function. By doing this, we get two major benefits:
- Exposure of new outlining candidates. There could be a repeated substring that was previously too short to outline which is sometimes adjacent to a return. The added return instruction could make it beneficial to outline.
- Saved instructions. On x86-64, if we can tail call a candidate, we simply outline the terminator/return along with the candidate, saving us a return in tail-called cases. On other targets, this is more significant. For example, if we outline a candidate as a tail-call on ARM64, we can avoid saving/restoring the link register at the call-site, saving two instructions per outlined call.
Minor changes:
- Changes to machine-outliner.ll test to ensure that it won't break if the order of outlined functions changes
- Expanded on the comments on the outlining hooks in TargetInstrInfo.h
This looks unintentional (rebaseing didn't take r296901 into account probably).