Add OPC_CheckChildSame0-3 to the DAG isel matcher. This replaces sequences of MoveChi...
[oota-llvm.git] / lib / CodeGen / Analysis.cpp
index 332a04255149c33187152961d265c971912798b7..1600c67a7c62550c48363b688a504e827cd53590 100644 (file)
@@ -510,6 +510,13 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS,
         return false;
     }
 
+  return returnTypeIsEligibleForTailCall(ExitBB->getParent(), I, Ret, TLI);
+}
+
+bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
+                                           const Instruction *I,
+                                           const ReturnInst *Ret,
+                                           const TargetLoweringBase &TLI) {
   // If the block ends with a void return or unreachable, it doesn't matter
   // what the call's return type is.
   if (!Ret || Ret->getNumOperands() == 0) return true;
@@ -519,7 +526,7 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS,
   if (isa<UndefValue>(Ret->getOperand(0))) return true;
 
   // Make sure the attributes attached to each return are compatible.
-  AttrBuilder CallerAttrs(ExitBB->getParent()->getAttributes(),
+  AttrBuilder CallerAttrs(F->getAttributes(),
                           AttributeSet::ReturnIndex);
   AttrBuilder CalleeAttrs(cast<CallInst>(I)->getAttributes(),
                           AttributeSet::ReturnIndex);