Skip to content

Commit

Permalink
update test2
Browse files Browse the repository at this point in the history
  • Loading branch information
jumormt committed Mar 20, 2024
1 parent 705c984 commit 264b5d4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Assignment-2/Test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int test2()

ICFGTraversal *traversal = new ICFGTraversal(svfir, icfg);
traversal->analyse();
Set<std::string> expected = {"START: 0->5->6->7->8->1->2->3->4->9->10->11->12->END"};
Set<std::string> 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();
Expand Down
3 changes: 2 additions & 1 deletion Assignment-2/testcase/bc/test2.ll
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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)
Expand Down
67 changes: 36 additions & 31 deletions Assignment-2/testcase/dot/test2.ll.icfg.dot
Original file line number Diff line number Diff line change
@@ -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\}|{<s0>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) |{<s0>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\}|{<s0>0x55fa19f570a0|<s1>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) |{<s0>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) |{<s0>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 }"];
}
1 change: 1 addition & 0 deletions Assignment-2/testcase/src/test2.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ void foo(int* p) {
int main() {
int a = 0;
foo(&a);
foo(&a);
svf_assert(a == 1);
}

0 comments on commit 264b5d4

Please sign in to comment.