[llvm-commits] [poolalloc] r119689 - in /poolalloc/trunk: include/dsa/DSCallGraph.h lib/DSA/DSTest.cpp test/dsa/callgraph/scc1.ll
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed Nov 17 23:23:12 PST 2010
Author: aggarwa4
Date: Thu Nov 18 01:23:12 2010
New Revision: 119689
URL: http://llvm.org/viewvc/llvm-project?rev=119689&view=rev
Log:
Fix testing for callgraphs with SCCs. Add testcase
for the same. Header file change to support getting
the leader for the SCC, given a function.
Added:
poolalloc/trunk/test/dsa/callgraph/scc1.ll
Modified:
poolalloc/trunk/include/dsa/DSCallGraph.h
poolalloc/trunk/lib/DSA/DSTest.cpp
Modified: poolalloc/trunk/include/dsa/DSCallGraph.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSCallGraph.h?rev=119689&r1=119688&r2=119689&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSCallGraph.h (original)
+++ poolalloc/trunk/include/dsa/DSCallGraph.h Thu Nov 18 01:23:12 2010
@@ -141,8 +141,10 @@
assert(F == SCCs.getLeaderValue(F) && "Requested non-leader");
return SCCs.member_end();
}
-
-
+
+ const llvm::Function* sccLeader(llvm::Function*F) const {
+ return SCCs.getLeaderValue(F);
+ }
unsigned callee_size(llvm::CallSite CS) const {
ActualCalleesTy::const_iterator ii = ActualCallees.find(CS);
if (ii == ActualCallees.end())
Modified: poolalloc/trunk/lib/DSA/DSTest.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSTest.cpp?rev=119689&r1=119688&r2=119689&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSTest.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSTest.cpp Thu Nov 18 01:23:12 2010
@@ -564,19 +564,24 @@
++I;
while(I != E ){
std::string &func = *(I);
- Function *callee = M->getFunction(func);
+ const Function *callee = M->getFunction(func);
bool found = false;
- // either the callee is found in the DSGraph
- for(DSCallGraph::flat_iterator CI = callgraph.flat_callee_begin(caller); CI != callgraph.flat_callee_end(caller); CI ++) {
- if (callee == *CI)
- found = true;
- //(*CI)->dump();
- }
- // or the callee is in the same SCC as the caller, and hence does not show up
- for(DSCallGraph::scc_iterator sccii = callgraph.scc_begin(caller), sccee = callgraph.scc_end(caller); sccii != sccee; ++sccii) {
+
+ Function const*leader = callgraph.sccLeader(&*caller);
+ // either the callee is in the same SCC as the caller, and hence does not show up
+ for(DSCallGraph::scc_iterator sccii = callgraph.scc_begin(leader), sccee = callgraph.scc_end(leader); sccii != sccee; ++sccii) {
if(callee == *sccii)
found = true;
}
+ // or the callee is found in the DSCallGraph
+ for(DSCallGraph::flat_iterator CI = callgraph.flat_callee_begin(caller); CI != callgraph.flat_callee_end(caller); CI ++) {
+ if (callee == *CI)
+ found = true;
+ for(DSCallGraph::scc_iterator sccii = callgraph.scc_begin(*CI), sccee = callgraph.scc_end(*CI); sccii != sccee; ++sccii) {
+ if(callee == *sccii)
+ found = true;
+ }
+ }
assert(found && "callee not in call graph");
++I;
}
Added: poolalloc/trunk/test/dsa/callgraph/scc1.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/callgraph/scc1.ll?rev=119689&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/callgraph/scc1.ll (added)
+++ poolalloc/trunk/test/dsa/callgraph/scc1.ll Thu Nov 18 01:23:12 2010
@@ -0,0 +1,33 @@
+;RUN: dsaopt %s -dsa-cbu -analyze -check-callees=C,A,B
+
+; ModuleID = 'scc.o'
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-unknown-linux-gnu"
+
+define internal void @A() nounwind {
+entry:
+ call void (...)* bitcast (void ()* @B to void (...)*)() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal void @B() nounwind {
+entry:
+ call void @A() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+define internal void @C() nounwind {
+entry:
+ call void @A() nounwind
+ call void @B() nounwind
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
More information about the llvm-commits
mailing list