]> granicus.if.org Git - llvm/commit
[X86] Fix latent bug in sibcall eligibility logic
authorReid Kleckner <rnk@google.com>
Fri, 28 Jul 2017 00:58:35 +0000 (00:58 +0000)
committerReid Kleckner <rnk@google.com>
Fri, 28 Jul 2017 00:58:35 +0000 (00:58 +0000)
commit7cc7cad98c2a69cb9eadef33a789129957a8dcf7
tree6a19a6096d409eced8331c4ff429f2e14a084931
parentbe07cfbcbd6310f8171bcfc5f645cdc06901b420
[X86] Fix latent bug in sibcall eligibility logic

The X86 tail call eligibility logic was correct when it was written, but
the addition of inalloca and argument copy elision broke its
assumptions. It was assuming that fixed stack objects were immutable.

Currently, we aim to emit a tail call if no arguments have to be
re-arranged in memory. This code would trace the outgoing argument
values back to check if they are loads from an incoming stack object.
If the stack argument is immutable, then we won't need to store it back
to the stack when we tail call.

Fortunately, stack objects track their mutability, so we can just make
the obvious check to fix the bug.

This was http://crbug.com/749826

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309343 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/tail-call-mutable-memarg.ll [new file with mode: 0644]