Date: Fri, 22 Nov 2013 17:54:54 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258472 - head/contrib/llvm/lib/Target/X86 Message-ID: <201311221754.rAMHssIV085268@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Fri Nov 22 17:54:53 2013 New Revision: 258472 URL: http://svnweb.freebsd.org/changeset/base/258472 Log: Revert r258455 for now, as it apparently causes miscompilation in some situations. Until this is fully resolved, the X.org workaround in ports still needs to take place. Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Nov 22 14:56:10 2013 (r258471) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Fri Nov 22 17:54:53 2013 (r258472) @@ -2449,15 +2449,21 @@ X86TargetLowering::LowerCall(TargetLower RegsToPass.push_back(std::make_pair(unsigned(X86::EBX), DAG.getNode(X86ISD::GlobalBaseReg, DebugLoc(), getPointerTy()))); } else { - // If we are tail calling a global or external symbol in GOT pic mode, we - // cannot use a direct jump, since that would make lazy dynamic linking - // impossible (see PR15086). So pretend this is not a tail call, to - // prevent the optimization to a jump. + // If we are tail calling and generating PIC/GOT style code load the + // address of the callee into ECX. The value in ecx is used as target of + // the tail jump. This is done to circumvent the ebx/callee-saved problem + // for tail calls on PIC/GOT architectures. Normally we would just put the + // address of GOT into ebx and then call target@PLT. But for tail calls + // ebx would be restored (since ebx is callee saved) before jumping to the + // target@PLT. + + // Note: The actual moving to ECX is done further down. GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee); - if ((G && !G->getGlobal()->hasHiddenVisibility() && - !G->getGlobal()->hasProtectedVisibility()) || - isa<ExternalSymbolSDNode>(Callee)) - isTailCall = false; + if (G && !G->getGlobal()->hasHiddenVisibility() && + !G->getGlobal()->hasProtectedVisibility()) + Callee = LowerGlobalAddress(Callee, DAG); + else if (isa<ExternalSymbolSDNode>(Callee)) + Callee = LowerExternalSymbol(Callee, DAG); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311221754.rAMHssIV085268>