Fix a bug when inserting a libcall into a function with no other calls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20999 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-04-02 03:22:40 +00:00
parent d4b57286dc
commit f4b457987f

View File

@ -1428,7 +1428,8 @@ static void FindEarliestAdjCallStackUp(SDNode *Node, SDNode *&Found) {
static SDNode *FindAdjCallStackUp(SDNode *Node) { static SDNode *FindAdjCallStackUp(SDNode *Node) {
if (Node->getOpcode() == ISD::ADJCALLSTACKUP) if (Node->getOpcode() == ISD::ADJCALLSTACKUP)
return Node; return Node;
assert(!Node->use_empty() && "Could not find ADJCALLSTACKUP!"); if (Node->use_empty())
return 0; // No adjcallstackup
if (Node->hasOneUse()) // Simple case, only has one user to check. if (Node->hasOneUse()) // Simple case, only has one user to check.
return FindAdjCallStackUp(*Node->use_begin()); return FindAdjCallStackUp(*Node->use_begin());
@ -1484,7 +1485,8 @@ SDOperand SelectionDAGLegalize::ExpandLibCall(const char *Name, SDNode *Node,
SDNode *OutChain; SDNode *OutChain;
SDOperand InChain = FindInputOutputChains(Node, OutChain, SDOperand InChain = FindInputOutputChains(Node, OutChain,
DAG.getEntryNode()); DAG.getEntryNode());
// TODO. Link in chains. if (InChain.Val == 0)
InChain = DAG.getEntryNode();
TargetLowering::ArgListTy Args; TargetLowering::ArgListTy Args;
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {