Speculatively disable x86 automatic tail call optimization while we track down a...
authorEvan Cheng <evan.cheng@apple.com>
Wed, 3 Feb 2010 21:40:40 +0000 (21:40 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 3 Feb 2010 21:40:40 +0000 (21:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95259 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/tailcall2.ll

index 9d6b5a39b2a0be14f19ee68074d7a1bebbbcbcc4..2b5ff3ca1a97772710e13ee479358fd78b64018e 100644 (file)
@@ -52,6 +52,7 @@ using namespace llvm;
 
 STATISTIC(NumTailCalls, "Number of tail calls");
 
+static cl::opt<unsigned> TailCallLimit("tailcall-limit", cl::init(0));
 static cl::opt<bool>
 DisableMMX("disable-mmx", cl::Hidden, cl::desc("Disable use of MMX"));
 
@@ -2271,6 +2272,8 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
 
   // Look for obvious safe cases to perform tail call optimization that does not
   // requite ABI changes. This is what gcc calls sibcall.
+  if (NumTailCalls >= TailCallLimit)
+    return false;
 
   // Do not tail call optimize vararg calls for now.
   if (isVarArg)
index 3cd8b26f608b4701f1e9f3ca5a8607c4eedd7fa4..b35fc4b5a58b361952a9023c4e021741fcedf3b8 100644 (file)
@@ -1,5 +1,6 @@
 ; RUN: llc < %s -march=x86    -asm-verbose=false | FileCheck %s -check-prefix=32
 ; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s -check-prefix=64
+; XFAIL: *
 
 define void @t1(i32 %x) nounwind ssp {
 entry: