This is an archive of the discontinued LLVM Phabricator instance.

[X86] Enable forwarding bool arguments in tail calls (PR26305)
ClosedPublic

Authored by hans on Mar 1 2016, 3:52 PM.

Details

Summary

The code was previously not able to trace a boolean argument at a call site back to the formal argument of the caller.

Diff Detail

Event Timeline

hans updated this revision to Diff 49559.Mar 1 2016, 3:52 PM
hans retitled this revision from to [X86] Enable forwarding bool arguments in tail calls (PR26305).
hans updated this object.
hans added a reviewer: rnk.
hans added a subscriber: llvm-commits.
rnk added inline comments.Mar 2 2016, 8:59 AM
lib/Target/X86/X86ISelLowering.cpp
3666

Maybe a do { ... } while (false) loop is appropriate here?

test/CodeGen/X86/tail-call-bools.ll
1 ↗(On Diff #49559)

Can you also run this in x86_64? The f_i32 guy will have to do movss %rcx, %xmm0 or something.

Also, maybe tail-call-casts.ll is a better name for the test, since it's not all about bools.

hans added inline comments.Mar 2 2016, 11:03 AM
lib/Target/X86/X86ISelLowering.cpp
3666

But then continue won't work?

test/CodeGen/X86/tail-call-bools.ll
1 ↗(On Diff #49559)

My change doesn't affect tail call arguments passed in registers, so is mostly not relevant for x86_64.

I do want to look into x86_64 in a follow-up though. For bools, we currently generate:

movzbl  %dil, %edi
jmp     g_bool

i.e. we do make the tail call, but we don't recognize that the argument can be forwarded as-is. The float bitcast test will come in handy to check that we don't mess that up.

I've renamed the test case.

hans updated this revision to Diff 49649.Mar 2 2016, 11:04 AM

Rename the test case.

rnk accepted this revision.Mar 2 2016, 4:53 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Mar 2 2016, 4:53 PM
This revision was automatically updated to reflect the committed changes.