diff --git a/Assignment-2/Test2.cpp b/Assignment-2/Test2.cpp index 2603573..dd3665e 100644 --- a/Assignment-2/Test2.cpp +++ b/Assignment-2/Test2.cpp @@ -85,7 +85,7 @@ int test2() ICFGTraversal *traversal = new ICFGTraversal(svfir, icfg); traversal->analyse(); - Set expected = {"START: 0->5->6->7->8->1->2->3->4->9->10->11->12->END"}; + Set expected = {"START: 0->5->6->7->8->1->2->3->4->9->10->1->2->3->4->11->12->13->14->END"}; assert(expected == traversal->getPaths() && "test2 failed!"); std::cout << SVFUtil::sucMsg("test2 passed!") << std::endl; SVF::LLVMModuleSet::releaseLLVMModuleSet(); diff --git a/Assignment-2/testcase/bc/test2.ll b/Assignment-2/testcase/bc/test2.ll index 8a33cf6..e15827d 100644 --- a/Assignment-2/testcase/bc/test2.ll +++ b/Assignment-2/testcase/bc/test2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'test2.ll' -source_filename = "test2.c" +source_filename = "../Assignment-2/testcase/src/test2.c" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -16,6 +16,7 @@ entry: %a = alloca i32, align 4 store i32 0, ptr %a, align 4 call void @foo(ptr noundef %a) + call void @foo(ptr noundef %a) %0 = load i32, ptr %a, align 4 %cmp = icmp eq i32 %0, 1 call void @svf_assert(i1 noundef zeroext %cmp) diff --git a/Assignment-2/testcase/dot/test2.ll.icfg.dot b/Assignment-2/testcase/dot/test2.ll.icfg.dot index 3c17d80..c2d9ea0 100644 --- a/Assignment-2/testcase/dot/test2.ll.icfg.dot +++ b/Assignment-2/testcase/dot/test2.ll.icfg.dot @@ -1,35 +1,40 @@ digraph "ICFG" { label="ICFG"; - Node0x2bdb7f0 [shape=record,color=purple,label="{GlobalICFGNode0\nCopyStmt: [Var1 \<-- Var0] \n ptr null \{ constant data \}\nAddrStmt: [Var17 \<-- Var3] \n i32 0 \{ constant data \}\nAddrStmt: [Var9 \<-- Var3] \n i32 1 \{ constant data \}\nAddrStmt: [Var4 \<-- Var5] \nFunction: foo \nAddrStmt: [Var11 \<-- Var12] \nFunction: main \nAddrStmt: [Var22 \<-- Var23] \nFunction: svf_assert }"]; - Node0x2bdb7f0 -> Node0x2b82780[style=solid]; - Node0x2be6e00 [shape=record,color=yellow,label="{FunEntryICFGNode1 \{fun: foo\}}"]; - Node0x2be6e00 -> Node0x2b91cd0[style=solid]; - Node0x2b91cd0 [shape=record,color=black,label="{IntraICFGNode2 \{fun: foo\}\nStoreStmt: [Var7 \<-- Var9] \n store i32 1, ptr %p, align 4 }"]; - Node0x2b91cd0 -> Node0x2bcbeb0[style=solid]; - Node0x2bcbeb0 [shape=record,color=black,label="{IntraICFGNode3 \{fun: foo\}\n ret void }"]; - Node0x2bcbeb0 -> Node0x2b866b0[style=solid]; - Node0x2b866b0 [shape=record,color=green,label="{FunExitICFGNode4 \{fun: foo\}|{0x2bad030}}"]; - Node0x2b866b0:s0 -> Node0x2b7af30[style=solid,color=blue]; - Node0x2b82780 [shape=record,color=yellow,label="{FunEntryICFGNode5 \{fun: main\}}"]; - Node0x2b82780 -> Node0x2b871c0[style=solid]; - Node0x2b871c0 [shape=record,color=black,label="{IntraICFGNode6 \{fun: main\}\nAddrStmt: [Var14 \<-- Var15] \n %a = alloca i32, align 4 }"]; - Node0x2b871c0 -> Node0x2bc3680[style=solid]; - Node0x2bc3680 [shape=record,color=black,label="{IntraICFGNode7 \{fun: main\}\nStoreStmt: [Var14 \<-- Var17] \n store i32 0, ptr %a, align 4 }"]; - Node0x2bc3680 -> Node0x2bfedc0[style=solid]; - Node0x2bfedc0 [shape=record,color=red,label="{CallICFGNode8 \{fun: main\}\nCallPE: [Var7 \<-- Var14] \n call void @foo(ptr noundef %a) |{0x2bad030}}"]; - Node0x2bfedc0:s0 -> Node0x2be6e00[style=solid,color=red]; - Node0x2b7af30 [shape=record,color=blue,label="{RetICFGNode9 \{fun: main\}}"]; - Node0x2b7af30 -> Node0x2bfb6a0[style=solid]; - Node0x2bfb6a0 [shape=record,color=black,label="{IntraICFGNode10 \{fun: main\}\nLoadStmt: [Var19 \<-- Var14] \n %0 = load i32, ptr %a, align 4 }"]; - Node0x2bfb6a0 -> Node0x2c094b0[style=solid]; - Node0x2c094b0 [shape=record,color=black,label="{IntraICFGNode11 \{fun: main\}\nCmpStmt: [Var20 \<-- (Var19 predicate32 Var9)] \n %cmp = icmp eq i32 %0, 1 }"]; - Node0x2c094b0 -> Node0x2b86d80[style=solid]; - Node0x2b86d80 [shape=record,color=red,label="{CallICFGNode12 \{fun: main\}}"]; - Node0x2b86d80 -> Node0x2b75380[style=solid]; - Node0x2b75380 [shape=record,color=blue,label="{RetICFGNode13 \{fun: main\}}"]; - Node0x2b75380 -> Node0x2bf6330[style=solid]; - Node0x2bf6330 [shape=record,color=black,label="{IntraICFGNode14 \{fun: main\}\n ret i32 0 }"]; - Node0x2bf6330 -> Node0x2bdbb70[style=solid]; - Node0x2bdbb70 [shape=record,color=green,label="{FunExitICFGNode15 \{fun: main\}\nPhiStmt: [Var13 \<-- ([Var17, ICFGNode14],)] \n ret i32 0 }"]; + Node0x55fa19f4fb60 [shape=record,color=purple,label="{GlobalICFGNode0\nCopyStmt: [Var1 \<-- Var0] \n ptr null \{ constant data \}\nAddrStmt: [Var17 \<-- Var3] \n i32 0 \{ constant data \}\nAddrStmt: [Var9 \<-- Var3] \n i32 1 \{ constant data \}\nAddrStmt: [Var4 \<-- Var5] \nFunction: foo \nAddrStmt: [Var11 \<-- Var12] \nFunction: main \nAddrStmt: [Var23 \<-- Var24] \nFunction: svf_assert }"]; + Node0x55fa19f4fb60 -> Node0x55fa19ede550[style=solid]; + Node0x55fa19f428a0 [shape=record,color=yellow,label="{FunEntryICFGNode1 \{fun: foo\}}"]; + Node0x55fa19f428a0 -> Node0x55fa19f29490[style=solid]; + Node0x55fa19f29490 [shape=record,color=black,label="{IntraICFGNode2 \{fun: foo\}\nStoreStmt: [Var7 \<-- Var9] \n store i32 1, ptr %p, align 4 }"]; + Node0x55fa19f29490 -> Node0x55fa19eead10[style=solid]; + Node0x55fa19eead10 [shape=record,color=black,label="{IntraICFGNode3 \{fun: foo\}\n ret void }"]; + Node0x55fa19eead10 -> Node0x55fa19f48a00[style=solid]; + Node0x55fa19f48a00 [shape=record,color=green,label="{FunExitICFGNode4 \{fun: foo\}|{0x55fa19f570a0|0x55fa19f75220}}"]; + Node0x55fa19f48a00:s0 -> Node0x55fa19ed6350[style=solid,color=blue]; + Node0x55fa19f48a00:s1 -> Node0x55fa19ed0390[style=solid,color=blue]; + Node0x55fa19ede550 [shape=record,color=yellow,label="{FunEntryICFGNode5 \{fun: main\}}"]; + Node0x55fa19ede550 -> Node0x55fa19f1f1e0[style=solid]; + Node0x55fa19f1f1e0 [shape=record,color=black,label="{IntraICFGNode6 \{fun: main\}\nAddrStmt: [Var14 \<-- Var15] \n %a = alloca i32, align 4 }"]; + Node0x55fa19f1f1e0 -> Node0x55fa19f57b70[style=solid]; + Node0x55fa19f57b70 [shape=record,color=black,label="{IntraICFGNode7 \{fun: main\}\nStoreStmt: [Var14 \<-- Var17] \n store i32 0, ptr %a, align 4 }"]; + Node0x55fa19f57b70 -> Node0x55fa19f43e00[style=solid]; + Node0x55fa19f43e00 [shape=record,color=red,label="{CallICFGNode8 \{fun: main\}\nCallPE: [Var7 \<-- Var14] \n call void @foo(ptr noundef %a) |{0x55fa19f570a0}}"]; + Node0x55fa19f43e00:s0 -> Node0x55fa19f428a0[style=solid,color=red]; + Node0x55fa19ed6350 [shape=record,color=blue,label="{RetICFGNode9 \{fun: main\}}"]; + Node0x55fa19ed6350 -> Node0x55fa19ee6ab0[style=solid]; + Node0x55fa19ee6ab0 [shape=record,color=red,label="{CallICFGNode10 \{fun: main\}\nCallPE: [Var7 \<-- Var14] \n call void @foo(ptr noundef %a) |{0x55fa19f75220}}"]; + Node0x55fa19ee6ab0:s0 -> Node0x55fa19f428a0[style=solid,color=red]; + Node0x55fa19ed0390 [shape=record,color=blue,label="{RetICFGNode11 \{fun: main\}}"]; + Node0x55fa19ed0390 -> Node0x55fa19f3fc90[style=solid]; + Node0x55fa19f3fc90 [shape=record,color=black,label="{IntraICFGNode12 \{fun: main\}\nLoadStmt: [Var20 \<-- Var14] \n %0 = load i32, ptr %a, align 4 }"]; + Node0x55fa19f3fc90 -> Node0x55fa19f34f00[style=solid]; + Node0x55fa19f34f00 [shape=record,color=black,label="{IntraICFGNode13 \{fun: main\}\nCmpStmt: [Var21 \<-- (Var20 predicate32 Var9)] \n %cmp = icmp eq i32 %0, 1 }"]; + Node0x55fa19f34f00 -> Node0x55fa19ee6ba0[style=solid]; + Node0x55fa19ee6ba0 [shape=record,color=red,label="{CallICFGNode14 \{fun: main\}}"]; + Node0x55fa19ee6ba0 -> Node0x55fa19f08150[style=solid]; + Node0x55fa19f08150 [shape=record,color=blue,label="{RetICFGNode15 \{fun: main\}}"]; + Node0x55fa19f08150 -> Node0x55fa19f3de00[style=solid]; + Node0x55fa19f3de00 [shape=record,color=black,label="{IntraICFGNode16 \{fun: main\}\n ret i32 0 }"]; + Node0x55fa19f3de00 -> Node0x55fa19f2b0e0[style=solid]; + Node0x55fa19f2b0e0 [shape=record,color=green,label="{FunExitICFGNode17 \{fun: main\}\nPhiStmt: [Var13 \<-- ([Var17, ICFGNode16],)] \n ret i32 0 }"]; } diff --git a/Assignment-2/testcase/src/test2.c b/Assignment-2/testcase/src/test2.c index 8aa5c4d..0c7016d 100644 --- a/Assignment-2/testcase/src/test2.c +++ b/Assignment-2/testcase/src/test2.c @@ -9,5 +9,6 @@ void foo(int* p) { int main() { int a = 0; foo(&a); + foo(&a); svf_assert(a == 1); } \ No newline at end of file