summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-01-17 00:14:25 +0000
committerGabor Greif <ggreif@gmail.com>2009-01-17 00:14:25 +0000
commit7b98424f719bf0bde6250e35d311e877d6c3d5b7 (patch)
tree94a09da518ef9623cd7d2256c864cc92532d1a66 /lib/Analysis
parent125329891f97baedef21e4b464ba70182c3fb45e (diff)
downloadllvm-7b98424f719bf0bde6250e35d311e877d6c3d5b7.tar.gz
llvm-7b98424f719bf0bde6250e35d311e877d6c3d5b7.tar.bz2
llvm-7b98424f719bf0bde6250e35d311e877d6c3d5b7.tar.xz
speed up iterative loop by using iterators. changes direction, but functionally equivalent
if this works out, I'll change the others next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62385 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index c1082a0028..b459246c29 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -260,10 +260,10 @@ void CallGraphNode::dump() const { print(cerr); }
/// specified call site. Note that this method takes linear time, so it
/// should be used sparingly.
void CallGraphNode::removeCallEdgeFor(CallSite CS) {
- for (unsigned i = CalledFunctions.size(); ; --i) {
- assert(i && "Cannot find callsite to remove!");
- if (CalledFunctions[i-1].first == CS) {
- CalledFunctions.erase(CalledFunctions.begin()+i-1);
+ for (CalledFunctionsVector::iterator I = CalledFunctions.begin(); ; ++I) {
+ assert(I != CalledFunctions.end() && "Cannot find callsite to remove!");
+ if (I->first == CS) {
+ CalledFunctions.erase(I);
return;
}
}