This is an archive of the discontinued LLVM Phabricator instance.

TargetInstrInfo: Provide default implementation of isTailCall().
ClosedPublic

Authored by MatzeB on Mar 8 2017, 10:25 AM.

Details

Summary

In fact this default implementation should be the only implementation,
keep it virtual for now to accomodate targets that don't model flags
correctly.

Diff Detail

Repository
rL LLVM

Event Timeline

MatzeB created this revision.Mar 8 2017, 10:25 AM

I did not touch HexagonInstrInfo::isTailCall() here as it wasn't immediately obvious whether the flags are correct there and the default implementation would work. Some target maintainer should double check and if so maybe we can get rid of the complete callback.

I did not touch HexagonInstrInfo::isTailCall() here as it wasn't immediately obvious whether the flags are correct there and the default implementation would work. Some target maintainer should double check and if so maybe we can get rid of the complete callback.

Hexagon has over 100 different opcodes for branches, and each of them can be used as a tail call. We are not going to invent 100+ phony opcodes just to put flags on them.

I did not touch HexagonInstrInfo::isTailCall() here as it wasn't immediately obvious whether the flags are correct there and the default implementation would work. Some target maintainer should double check and if so maybe we can get rid of the complete callback.

Hexagon has over 100 different opcodes for branches, and each of them can be used as a tail call. We are not going to invent 100+ phony opcodes just to put flags on them.

Yes I somewhat expected this answer and that we will end up in a similar discussion as in http://llvm.org/PR31960. So let's keep the callback (and the comment about wrong flags).

dberris accepted this revision.Mar 15 2017, 4:23 PM

LGTM -- I suspect this doesn't break the compiler-rt tests for XRay?

include/llvm/Target/TargetInstrInfo.h
1499–1501 ↗(On Diff #91048)

Can we make this comment more direct? Something like:

"Override this method for targets where tail calls are not always both return and call instructions."

This revision is now accepted and ready to land.Mar 15 2017, 4:23 PM

LGTM -- I suspect this doesn't break the compiler-rt tests for XRay?

Can I even run them on a mac? I also don't have PPC hardware available. But we surely have buildbots for that (and if not I blame someone else for the lack of bots).

include/llvm/Target/TargetInstrInfo.h
1499–1501 ↗(On Diff #91048)

Ok how about

"Override this method on targets that do not properly set MCID::Return and MCID::Call on tail call instructions."

to not give the impression that this is recommended.

LGTM -- I suspect this doesn't break the compiler-rt tests for XRay?

Can I even run them on a mac? I also don't have PPC hardware available. But we surely have buildbots for that (and if not I blame someone else for the lack of bots).

Nope, the XRay runtime doesn't work in MacOS yet.

There are bots that run these. I'm not sure if you want to wait to find out if they break. :)

include/llvm/Target/TargetInstrInfo.h
1499–1501 ↗(On Diff #91048)

That's better I think.

LGTM -- I suspect this doesn't break the compiler-rt tests for XRay?

Can I even run them on a mac? I also don't have PPC hardware available. But we surely have buildbots for that (and if not I blame someone else for the lack of bots).

Nope, the XRay runtime doesn't work in MacOS yet.

There are bots that run these. I'm not sure if you want to wait to find out if they break. :)

Unless you run them for me that's all I can do. Reverts are cheap (breaking the build isn't so nice but as long as we don't have pre-commit checking in llvm...).

This revision was automatically updated to reflect the committed changes.