This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Defer setting HasCalls on MachineFrameInfo to selection time.
ClosedPublic

Authored by aemerson on Sep 20 2019, 3:59 PM.

Details

Summary

We currently always set the HasCalls on MFI during translation and legalization if we're handling a call or legalizing to a libcall. However, if that call is later optimized to a tail call then we don't need the flag. The flag being set to true causes frame lowering to always save and restore FP/LR, which adds unnecessary code.

This change does the same thing as SelectionDAG and ports over some code that scans instructions after selection, using TargetInstrInfo to determine if target opcodes are known calls.

Code size geomean improvements on CTMark:
-O0 : 0.1%
-Os : 0.3%

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Sep 20 2019, 3:59 PM
arsenm accepted this revision.Sep 20 2019, 4:16 PM

LGTM. This also solves reporting calls for things lowered to libcalls

llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
237–238 ↗(On Diff #221130)

You can check theses directly on MI

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