diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-02-05 21:59:58 +0000 |
| commit | 80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3 (patch) | |
| tree | 3f673a8f067a74d590664cac2261c794015f6905 /llvm/lib/Analysis/DataStructure/Local.cpp | |
| parent | 5981c63e6e0a339c49441235a68426ed159b3cd6 (diff) | |
| download | bcm5719-llvm-80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3.tar.gz bcm5719-llvm-80614ee5ef9129cb3d6a7eefccad0ec31fd2e3a3.zip | |
Implement optimization for direct function call case. This dramatically
reduces the number of function nodes created and speeds up analysis by
about 10% overall.
llvm-svn: 5495
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/Local.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index a4e7b631816..d56ad01f0ae 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -19,6 +19,7 @@ #include "llvm/Target/TargetData.h" #include "Support/Statistic.h" #include "Support/Timer.h" +#include "Support/CommandLine.h" // FIXME: This should eventually be a FunctionPass that is automatically // aggregated into a Pass. @@ -45,6 +46,11 @@ using namespace DS; namespace { + cl::opt<bool> + DisableDirectCallOpt("disable-direct-call-dsopt", cl::Hidden, + cl::desc("Disable direct call optimization in " + "DSGraph construction")); + //===--------------------------------------------------------------------===// // GraphBuilder Class //===--------------------------------------------------------------------===// @@ -375,7 +381,9 @@ void GraphBuilder::visitCallInst(CallInst &CI) { if (isPointerType(CI.getType())) RetVal = getValueDest(CI); - DSNodeHandle Callee = getValueDest(*CI.getOperand(0)); + DSNode *Callee = 0; + if (DisableDirectCallOpt || !isa<Function>(CI.getOperand(0))) + Callee = getValueDest(*CI.getOperand(0)).getNode(); std::vector<DSNodeHandle> Args; Args.reserve(CI.getNumOperands()-1); @@ -386,7 +394,11 @@ void GraphBuilder::visitCallInst(CallInst &CI) { Args.push_back(getValueDest(*CI.getOperand(i))); // Add a new function call entry... - FunctionCalls.push_back(DSCallSite(CI, RetVal, Callee, Args)); + if (Callee) + FunctionCalls.push_back(DSCallSite(CI, RetVal, Callee, Args)); + else + FunctionCalls.push_back(DSCallSite(CI, RetVal, + cast<Function>(CI.getOperand(0)), Args)); } void GraphBuilder::visitFreeInst(FreeInst &FI) { |

