Fix a long standing tail call optimization bug. When a libcall is emitted
authorEvan Cheng <evan.cheng@apple.com>
Tue, 10 Apr 2012 01:51:00 +0000 (01:51 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 10 Apr 2012 01:51:00 +0000 (01:51 +0000)
commitbf010eb9110009d745382bf15131fbe556562ffe
tree405ab5a6ff8413b77e23379a20f64a60d5a63721
parentfdb230a154ead49cf0ded5b4587be994ec2f43e0
Fix a long standing tail call optimization bug. When a libcall is emitted
legalizer always use the DAG entry node. This is wrong when the libcall is
emitted as a tail call since it effectively folds the return node. If
the return node's input chain is not the entry (i.e. call, load, or store)
use that as the tail call input chain.

PR12419
rdar://9770785
rdar://11195178

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154370 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/Analysis.h
include/llvm/Target/TargetLowering.h
lib/CodeGen/Analysis.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86ISelLowering.h
test/CodeGen/ARM/call-tc.ll