Prevent obscure and incorrect tail-call optimization.
[oota-llvm.git] / lib / Target / X86 / X86ISelLowering.cpp
index 4ad179ead669dcc611571770777fe69e1f3d4175..d1ded33384973332483329d33cadd9d6f2e047d6 100644 (file)
@@ -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) {