summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-09-09 19:56:34 +0000
committerDuncan Sands <baldrick@free.fr>2008-09-09 19:56:34 +0000
commite5579930dbf61d59611b877df01587f6a4700e4c (patch)
tree0602237756d3e0420910f2a9c76732f5c806ff98 /llvm/lib/Analysis/IPA/CallGraph.cpp
parent4f11d78fcc40957a378503fe07f5c3435d14663e (diff)
downloadbcm5719-llvm-e5579930dbf61d59611b877df01587f6a4700e4c.tar.gz
bcm5719-llvm-e5579930dbf61d59611b877df01587f6a4700e4c.zip
Simplify this some more. No functionality change.
llvm-svn: 56003
Diffstat (limited to 'llvm/lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/IPA/CallGraph.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp
index 1a65179c5aa..fba1d00d48c 100644
--- a/llvm/lib/Analysis/IPA/CallGraph.cpp
+++ b/llvm/lib/Analysis/IPA/CallGraph.cpp
@@ -124,26 +124,19 @@ private:
}
}
+ // Loop over all of the users of the function, looking for non-call uses.
+ for (Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E; ++I)
+ if ((!isa<CallInst>(*I) && !isa<InvokeInst>(*I)) || I.getOperandNo()) {
+ // Not a call, or being used as a parameter rather than as the callee.
+ ExternalCallingNode->addCalledFunction(CallSite(), Node);
+ break;
+ }
+
// If this function is not defined in this translation unit, it could call
// anything.
if (F->isDeclaration() && !F->isIntrinsic())
Node->addCalledFunction(CallSite(), CallsExternalNode);
- // Loop over all of the users of the function, looking for non-call uses.
- bool isUsedExternally = false;
- for (Value::use_iterator I = F->use_begin(), E = F->use_end();
- I != E && !isUsedExternally; ++I) {
- if (Instruction *Inst = dyn_cast<Instruction>(*I)) {
- CallSite CS = CallSite::get(Inst);
- // Not a call? Or F being passed as a parameter not as the callee?
- isUsedExternally = !CS.getInstruction() || I.getOperandNo();
- } else { // User is not a direct call!
- isUsedExternally = true;
- }
- }
- if (isUsedExternally)
- ExternalCallingNode->addCalledFunction(CallSite(), Node);
-
// Look for calls by this function.
for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB)
for (BasicBlock::iterator II = BB->begin(), IE = BB->end();
OpenPOWER on IntegriCloud