[llvm-commits] [llvm] r56003 - /llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Duncan Sands
baldrick at free.fr
Tue Sep 9 12:56:34 PDT 2008
Author: baldrick
Date: Tue Sep 9 14:56:34 2008
New Revision: 56003
URL: http://llvm.org/viewvc/llvm-project?rev=56003&view=rev
Log:
Simplify this some more. No functionality change.
Modified:
llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
Modified: llvm/trunk/lib/Analysis/IPA/CallGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraph.cpp?rev=56003&r1=56002&r2=56003&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraph.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraph.cpp Tue Sep 9 14:56:34 2008
@@ -124,26 +124,19 @@
}
}
+ // 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();
More information about the llvm-commits
mailing list