[llvm-commits] [poolalloc] r122699 - /poolalloc/trunk/test/dsa/callgraph/scc3b.c
Arushi Aggarwal
aggarwa4 at illinois.edu
Sun Jan 2 09:56:14 PST 2011
Author: aggarwa4
Date: Sun Jan 2 11:56:14 2011
New Revision: 122699
URL: http://llvm.org/viewvc/llvm-project?rev=122699&view=rev
Log:
Example for infinite looping in BU.
Added:
poolalloc/trunk/test/dsa/callgraph/scc3b.c
Added: poolalloc/trunk/test/dsa/callgraph/scc3b.c
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/callgraph/scc3b.c?rev=122699&view=auto
==============================================================================
--- poolalloc/trunk/test/dsa/callgraph/scc3b.c (added)
+++ poolalloc/trunk/test/dsa/callgraph/scc3b.c Sun Jan 2 11:56:14 2011
@@ -0,0 +1,47 @@
+// A, B, C, func are in an SCC
+// C is called indirectly from B
+// The indirect call site in C is resolved, once we inline C into B.
+
+// But since, B and C are in the same graph, inlining C with B,
+// merges the arguments for C with the actual arguments passed in
+// from B. This makes the function pointer being called to be
+// marked incomplete(coming from argument).
+
+// when we inline the SCCGraph into D(due to call to A), the unresolved
+// call site is also inlined. As it is complete and can be resolved
+// we inline the SCC graph again, pulling in the unresolved call site
+// again. This causes an infinte looping in BU.
+// XFAIL:*
+// RUN: not
+#include<stdio.h>
+
+typedef int* (*funcptr)(int *);
+
+static int* A(void);
+static int* B(void);
+static int* func(int*);
+static int* C(funcptr f, int *arg) ;
+
+static int* func(int * arg) {
+ A();
+ return C(NULL, arg);
+}
+
+static int* C(funcptr f, int *arg) {
+ A();
+ func(B());
+ (*f)(arg);
+}
+
+static int *B() {
+ func(A());
+ return C(func, A());
+}
+
+static int* A() {
+ return C(NULL,func(B()));
+}
+
+static int* D() {
+ return A();
+}
More information about the llvm-commits
mailing list