This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Recognize mnop-mcount in backend
ClosedPublic

Authored by jonpa on Sep 19 2019, 7:45 AM.

Details

Reviewers
uweigand
Summary

This patch is the backend part corresponding to https://reviews.llvm.org/D67763.

With -pg -mfentry -mnop-mcount, gcc emits 'brcl 0, 0'. Using EmitNop() gives a 'brcl 0, 6' instead - a jump to the next instruction. Is this acceptable?

Is report_fatal_error() the right way to exit with mcount + -mnop-mcount? It seems at least nicer than the stackdump given by llvm_unreachable().

Diff Detail

Event Timeline

jonpa created this revision.Sep 19 2019, 7:45 AM
jonpa updated this revision to Diff 221745.Sep 25 2019, 6:33 AM

The backend check for fentry could perhaps be performed in MachineFunction::init() somehow, but doing it fairly early in SystemZDAGToDAG::runOnMachineFunction() seems reasonable, or (we don't have any pre-isel passes that are always run)?

It seems safe to do e.g. F.getFnAttribute("fentry-call").getValueAsString() without a preceding F.hasFnAttribute("fentry-call"), but I am not 100% sure...

uweigand accepted this revision.Sep 25 2019, 9:30 AM

LGTM.

This revision is now accepted and ready to land.Sep 25 2019, 9:30 AM
jonpa closed this revision.Sep 26 2019, 1:37 AM

Thanks for review - r372950.

MaskRay added a subscriber: MaskRay.EditedDec 21 2019, 11:04 PM

The commit message should look like:

Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D67765

Then the differential will be closed automatically when you push the commit to master.

Some people include unrelated things like Tags: #llvm and Subscribers: in their commit messages. I think they are not good practice. Reviewed By+ Differential Revision should be sufficient.