# HG changeset patch # User Kaito Tokumori # Date 1383744604 -32400 # Node ID 9b9640b7b299c9174d60655bb6066e607df7e2c4 # Parent 7694d90773c72c90a5a87c00587742ef8a99ae42 bug fix : include error was removed. (It's due to access to a null pointer) diff -r 7694d90773c7 -r 9b9640b7b299 lib/Transforms/Scalar/TailRecursionElimination.cpp --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp Mon Nov 04 23:30:18 2013 +0900 +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp Wed Nov 06 22:30:04 2013 +0900 @@ -196,20 +196,6 @@ // doesn't). bool CannotTCETailMarkedCall = false; -#ifndef noCbC - if (!FunctionContainsEscapingAllocas && !F.callsFunctionThatReturnsTwice()) - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) - if (CallInst *CI = dyn_cast(I)) { - Function* CalledFunction = CI->getCalledFunction(); - if (CalledFunction != NULL) - if (CalledFunction->getReturnType()->is__CodeTy()){ - CI->setTailCall(); - MadeChange = true; - } - } -#endif - // Loop over the function, looking for any returning blocks, and keeping track // of whether this function has any non-trivially used allocas. for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { @@ -265,12 +251,14 @@ for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (CallInst *CI = dyn_cast(I)) { #ifndef noCbC - if (CI->getCalledFunction()->getReturnType()->is__CodeTy() || !isOnlyForCbC()) { + Function* CalledFunction = CI->getCalledFunction(); + if (CalledFunction != NULL) + if (CI->getCalledFunction()->getReturnType()->is__CodeTy() || !isOnlyForCbC()) { #endif - CI->setTailCall(); - MadeChange = true; + CI->setTailCall(); + MadeChange = true; #ifndef noCbC - } + } #endif } return MadeChange;