aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Analysis/LazyCallGraphTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Analysis/LazyCallGraphTest.cpp')
-rw-r--r--llvm/unittests/Analysis/LazyCallGraphTest.cpp208
1 files changed, 104 insertions, 104 deletions
diff --git a/llvm/unittests/Analysis/LazyCallGraphTest.cpp b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
index 4a4ff32..5c0bfbd 100644
--- a/llvm/unittests/Analysis/LazyCallGraphTest.cpp
+++ b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
@@ -142,78 +142,78 @@ static const char DiamondOfTriangles[] =
static const char DiamondOfTrianglesRefGraph[] =
"define void @a1() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @a2, void ()** %a\n"
- " store void ()* @b2, void ()** %a\n"
- " store void ()* @c3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @a2, ptr %a\n"
+ " store ptr @b2, ptr %a\n"
+ " store ptr @c3, ptr %a\n"
" ret void\n"
"}\n"
"define void @a2() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @a3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @a3, ptr %a\n"
" ret void\n"
"}\n"
"define void @a3() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @a1, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @a1, ptr %a\n"
" ret void\n"
"}\n"
"define void @b1() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @b2, void ()** %a\n"
- " store void ()* @d3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @b2, ptr %a\n"
+ " store ptr @d3, ptr %a\n"
" ret void\n"
"}\n"
"define void @b2() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @b3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @b3, ptr %a\n"
" ret void\n"
"}\n"
"define void @b3() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @b1, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @b1, ptr %a\n"
" ret void\n"
"}\n"
"define void @c1() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @c2, void ()** %a\n"
- " store void ()* @d2, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @c2, ptr %a\n"
+ " store ptr @d2, ptr %a\n"
" ret void\n"
"}\n"
"define void @c2() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @c3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @c3, ptr %a\n"
" ret void\n"
"}\n"
"define void @c3() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @c1, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @c1, ptr %a\n"
" ret void\n"
"}\n"
"define void @d1() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @d2, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @d2, ptr %a\n"
" ret void\n"
"}\n"
"define void @d2() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @d3, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @d3, ptr %a\n"
" ret void\n"
"}\n"
"define void @d3() {\n"
"entry:\n"
- " %a = alloca void ()*\n"
- " store void ()* @d1, void ()** %a\n"
+ " %a = alloca ptr\n"
+ " store ptr @d1, ptr %a\n"
" ret void\n"
"}\n";
@@ -1005,20 +1005,20 @@ TEST(LazyCallGraphTest, IncomingEdgeInsertionLargeRefCycle) {
std::unique_ptr<Module> M =
parseAssembly(Context, "define void @a() {\n"
"entry:\n"
- " %p = alloca void ()*\n"
- " store void ()* @b, void ()** %p\n"
+ " %p = alloca ptr\n"
+ " store ptr @b, ptr %p\n"
" ret void\n"
"}\n"
"define void @b() {\n"
"entry:\n"
- " %p = alloca void ()*\n"
- " store void ()* @c, void ()** %p\n"
+ " %p = alloca ptr\n"
+ " store ptr @c, ptr %p\n"
" ret void\n"
"}\n"
"define void @c() {\n"
"entry:\n"
- " %p = alloca void ()*\n"
- " store void ()* @d, void ()** %p\n"
+ " %p = alloca ptr\n"
+ " store ptr @d, ptr %p\n"
" ret void\n"
"}\n"
"define void @d() {\n"
@@ -1306,25 +1306,25 @@ TEST(LazyCallGraphTest, InternalEdgeRemoval) {
LLVMContext Context;
// A nice fully connected (including self-edges) RefSCC.
std::unique_ptr<Module> M = parseAssembly(
- Context, "define void @a(i8** %ptr) {\n"
+ Context, "define void @a(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @b(i8** %ptr) {\n"
+ "define void @b(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @c(i8** %ptr) {\n"
+ "define void @c(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1384,25 +1384,25 @@ TEST(LazyCallGraphTest, InternalMultiEdgeRemoval) {
LLVMContext Context;
// A nice fully connected (including self-edges) RefSCC.
std::unique_ptr<Module> M = parseAssembly(
- Context, "define void @a(i8** %ptr) {\n"
+ Context, "define void @a(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @b(i8** %ptr) {\n"
+ "define void @b(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @c(i8** %ptr) {\n"
+ "define void @c(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @a, ptr %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1454,22 +1454,22 @@ TEST(LazyCallGraphTest, InternalNoOpEdgeRemoval) {
// Reference edges: a -> b -> c -> a
// Call edges: a -> c -> b -> a
std::unique_ptr<Module> M = parseAssembly(
- Context, "define void @a(i8** %ptr) {\n"
+ Context, "define void @a(ptr %ptr) {\n"
"entry:\n"
- " call void @b(i8** %ptr)\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " call void @b(ptr %ptr)\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @b(i8** %ptr) {\n"
+ "define void @b(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @a to i8*), i8** %ptr\n"
- " call void @c(i8** %ptr)\n"
+ " store ptr @a, ptr %ptr\n"
+ " call void @c(ptr %ptr)\n"
" ret void\n"
"}\n"
- "define void @c(i8** %ptr) {\n"
+ "define void @c(ptr %ptr) {\n"
"entry:\n"
- " call void @a(i8** %ptr)\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
+ " call void @a(ptr %ptr)\n"
+ " store ptr @b, ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1622,24 +1622,24 @@ TEST(LazyCallGraphTest, InternalRefEdgeToCall) {
"entry:\n"
" call void @b()\n"
" call void @c()\n"
- " store void()* @d, void()** undef\n"
+ " store ptr @d, ptr undef\n"
" ret void\n"
"}\n"
"define void @b() {\n"
"entry:\n"
- " store void()* @c, void()** undef\n"
+ " store ptr @c, ptr undef\n"
" call void @d()\n"
" ret void\n"
"}\n"
"define void @c() {\n"
"entry:\n"
- " store void()* @b, void()** undef\n"
+ " store ptr @b, ptr undef\n"
" call void @d()\n"
" ret void\n"
"}\n"
"define void @d() {\n"
"entry:\n"
- " store void()* @a, void()** undef\n"
+ " store ptr @a, ptr undef\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1745,13 +1745,13 @@ TEST(LazyCallGraphTest, InternalRefEdgeToCallNoCycleInterleaved) {
"}\n"
"define void @c3() {\n"
"entry:\n"
- " store void()* @b1, void()** undef\n"
+ " store ptr @b1, ptr undef\n"
" call void @d()\n"
" ret void\n"
"}\n"
"define void @d() {\n"
"entry:\n"
- " store void()* @a, void()** undef\n"
+ " store ptr @a, ptr undef\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1875,13 +1875,13 @@ TEST(LazyCallGraphTest, InternalRefEdgeToCallBothPartitionAndMerge) {
"}\n"
"define void @f() {\n"
"entry:\n"
- " store void()* @b, void()** undef\n"
+ " store ptr @b, ptr undef\n"
" call void @g()\n"
" ret void\n"
"}\n"
"define void @g() {\n"
"entry:\n"
- " store void()* @a, void()** undef\n"
+ " store ptr @a, ptr undef\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1962,9 +1962,9 @@ TEST(LazyCallGraphTest, HandleBlockAddress) {
"bb:\n"
" unreachable\n"
"}\n"
- "define void @g(i8** %ptr) {\n"
+ "define void @g(ptr %ptr) {\n"
"entry:\n"
- " store i8* blockaddress(@f, %bb), i8** %ptr\n"
+ " store ptr blockaddress(@f, %bb), ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -1991,9 +1991,9 @@ TEST(LazyCallGraphTest, HandleBlockAddress2) {
parseAssembly(Context, "define void @f() {\n"
" ret void\n"
"}\n"
- "define void @g(i8** %ptr) {\n"
+ "define void @g(ptr %ptr) {\n"
"bb:\n"
- " store i8* blockaddress(@g, %bb), i8** %ptr\n"
+ " store ptr blockaddress(@g, %bb), ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -2018,31 +2018,31 @@ TEST(LazyCallGraphTest, ReplaceNodeFunction) {
// function.
std::unique_ptr<Module> M =
parseAssembly(Context,
- "define void @a(i8** %ptr) {\n"
+ "define void @a(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
+ " store ptr @d, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @b(i8** %ptr) {\n"
+ "define void @b(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
- " call void @d(i8** %ptr)"
+ " store ptr @d, ptr %ptr\n"
+ " store ptr @d, ptr %ptr\n"
+ " call void @d(ptr %ptr)"
" ret void\n"
"}\n"
- "define void @c(i8** %ptr) {\n"
+ "define void @c(ptr %ptr) {\n"
"entry:\n"
- " call void @d(i8** %ptr)"
- " call void @d(i8** %ptr)"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
+ " call void @d(ptr %ptr)"
+ " call void @d(ptr %ptr)"
+ " store ptr @d, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @d(i8** %ptr) {\n"
+ "define void @d(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
- " call void @c(i8** %ptr)"
- " call void @d(i8** %ptr)"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
+ " store ptr @b, ptr %ptr\n"
+ " call void @c(ptr %ptr)"
+ " call void @d(ptr %ptr)"
+ " store ptr @d, ptr %ptr\n"
" ret void\n"
"}\n");
LazyCallGraph CG = buildCG(*M);
@@ -2098,25 +2098,25 @@ TEST(LazyCallGraphTest, RemoveFunctionWithSpuriousRef) {
// A graph with a couple of RefSCCs.
std::unique_ptr<Module> M =
parseAssembly(Context,
- "define void @a(i8** %ptr) {\n"
+ "define void @a(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @d to i8*), i8** %ptr\n"
+ " store ptr @d, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @b(i8** %ptr) {\n"
+ "define void @b(ptr %ptr) {\n"
"entry:\n"
- " store i8* bitcast (void(i8**)* @c to i8*), i8** %ptr\n"
+ " store ptr @c, ptr %ptr\n"
" ret void\n"
"}\n"
- "define void @c(i8** %ptr) {\n"
+ "define void @c(ptr %ptr) {\n"
"entry:\n"
- " call void @d(i8** %ptr)"
+ " call void @d(ptr %ptr)"
" ret void\n"
"}\n"
- "define void @d(i8** %ptr) {\n"
+ "define void @d(ptr %ptr) {\n"
"entry:\n"
- " call void @c(i8** %ptr)"
- " store i8* bitcast (void(i8**)* @b to i8*), i8** %ptr\n"
+ " call void @c(ptr %ptr)"
+ " store ptr @b, ptr %ptr\n"
" ret void\n"
"}\n"
"define void @dead() {\n"
@@ -2965,7 +2965,7 @@ TEST(LazyCallGraphTest, AddSplitFunctions5) {
LLVMContext Context;
std::unique_ptr<Module> M =
parseAssembly(Context, "define void @f() {\n"
- " %1 = bitcast void ()* @f2 to i8*\n"
+ " %1 = bitcast ptr @f2 to ptr\n"
" ret void\n"
"}\n"
"define void @f2() {\n"