mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Prevent obscure and incorrect tail-call optimization.
In this instance we are generating the tail-call during legalizeDAG. The 2nd floor call can't be a tail call because it clobbers %xmm1, which is defined by the first floor call. The first floor call can't be a tail-call because it's not in the tail position. The only reasonable way I could think to fix this in a target-independent manner was to check for glue logic on the copy reg. rdar://10930395 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1589,6 +1589,11 @@ bool X86TargetLowering::isUsedByReturnOnly(SDNode *N) const {
|
||||
Copy->getOpcode() != ISD::FP_EXTEND)
|
||||
return false;
|
||||
|
||||
// If anything is glued to the copy, then we can't safely perform a tail call.
|
||||
if (Copy->getOpcode() == ISD::CopyToReg &&
|
||||
Copy->getNumOperands() == 4)
|
||||
return false;
|
||||
|
||||
bool HasRet = false;
|
||||
for (SDNode::use_iterator UI = Copy->use_begin(), UE = Copy->use_end();
|
||||
UI != UE; ++UI) {
|
||||
|
||||
Reference in New Issue
Block a user