Make the code slightly more palatable.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 10 Apr 2012 03:15:18 +0000 (03:15 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 10 Apr 2012 03:15:18 +0000 (03:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154378 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 22b5ae602ceeac3eeb510792dc388648dd35fc16..a96a99781f4e07a05bdf158fe8f6dd9bfc2a05f3 100644 (file)
@@ -1790,7 +1790,11 @@ SDValue SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
 
   // isTailCall may be true since the callee does not reference caller stack
   // frame. Check if it's in the right position.
-  bool isTailCall = isInTailCallPosition(DAG, Node, InChain, TLI);
+  SDValue TCChain = InChain;
+  bool isTailCall = isInTailCallPosition(DAG, Node, TCChain, TLI);
+  if (isTailCall)
+    InChain = TCChain;
+
   std::pair<SDValue, SDValue> CallInfo =
     TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
                     0, TLI.getLibcallCallingConv(LC), isTailCall,