This is an archive of the discontinued LLVM Phabricator instance.

[SystemZ] Support conditional sibling calls via BRCL.
ClosedPublic

Authored by koriakin on Apr 7 2016, 12:45 PM.

Details

Summary

This adds a conditional variant of CallJG instruction, CallBRCL.
It can be used for conditional sibling calls. Unfortunately, due
to IfCvt limitations, it only really works well for functions without
arguments.

Diff Detail

Repository
rL LLVM

Event Timeline

koriakin retitled this revision from to [SystemZ] Support conditional sibling calls via BRCL..
koriakin updated this object.
koriakin added a reviewer: uweigand.
koriakin set the repository for this revision to rL LLVM.
koriakin added a subscriber: llvm-commits.

This is the third patch for issue #23417 - direct conditional sibling calls. Compare and branch instructions are of no use here, as they have limitted reach. This is not as useful as I hoped, as it usually only triggers for calls without parameters - eg. for f3 in the attached test, IfCvt bails on the llhi instruction loading the parameter, even after I make all the IsIfCvt*Profitable functions always return true.

I'll also submit a 4th patch for indirect conditional sibling calls, but these are even more limitted, since the transformation only triggers if the function to call is already in %r1 (otherwise, the unpredicable load disturbs IfCvt). I was also considering adding a plain BCR instruction as a predicated variant of BR for switches, but since switches always (?) have the address arithmetic instructions between value-in-range check and indirect jump, it'd be rather useless.

uweigand accepted this revision.Apr 8 2016, 10:25 AM
uweigand edited edge metadata.

LGTM, thanks. I'll check it in shortly.

This revision is now accepted and ready to land.Apr 8 2016, 10:25 AM
This revision was automatically updated to reflect the committed changes.