Skip to content

Commit ceb9cdb

Browse files
committed
More dependence graph tests
1 parent 71324e7 commit ceb9cdb

File tree

12 files changed

+162
-0
lines changed

12 files changed

+162
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
int a;
2+
3+
void main(void)
4+
{
5+
int i = 0;
6+
7+
if(i < 10)
8+
{
9+
a = 1;
10+
}
11+
else
12+
{
13+
a = 2;
14+
}
15+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// First assignment has a control dependency on the if
8+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1
9+
// Second assignment has a control dependency on the if
10+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2
11+
--
12+
^warning: ignoring
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
int a;
2+
3+
void func()
4+
{
5+
}
6+
7+
void main(void)
8+
{
9+
func();
10+
11+
if(a < 10)
12+
{
13+
a = 1;
14+
}
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// Assignment has a control dependency on the if
8+
\/\/ ([0-9]+).*\n.*IF.*a < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1
9+
--
10+
^warning: ignoring
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
int a;
2+
3+
void func()
4+
{
5+
}
6+
7+
void main(void)
8+
{
9+
if(a < 7)
10+
{
11+
goto L;
12+
}
13+
14+
if(a < 10)
15+
{
16+
func();
17+
L:
18+
a = 1;
19+
a = 2;
20+
}
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// Assignment has a control dependency on the if
8+
\/\/ ([0-9]+).*\n.*IF.*a < 10.*THEN(.*\n)*Control dependencies: .*\1.*\n(.*\n){2,3}.*a = 2
9+
--
10+
^warning: ignoring
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
int a;
2+
3+
void main(void)
4+
{
5+
int i = 0;
6+
while(i < 10)
7+
{
8+
a = 1;
9+
}
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// Assignment has a control dependency on the loop head
8+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1
9+
// Backedge has a control dependency on the loop head
10+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}\s*GOTO [0-9]+
11+
// Loop head has a control dependency on itself
12+
Control dependencies: ([0-9]+)\n(.*\n)?\n.*\/\/ \1.*\n.*IF.*i < 10.*THEN
13+
--
14+
^warning: ignoring
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
int a;
2+
3+
void main(void)
4+
{
5+
int i = 0;
6+
while(i < 10)
7+
{
8+
if(i < 7)
9+
{
10+
a = 1;
11+
}
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// Assignment has a control dependency on the if
8+
\/\/ ([0-9]+).*\n.*IF.*i < 7.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1
9+
// If has a control dependency on the loop head
10+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*i < 7
11+
--
12+
^warning: ignoring
13+
// Assignment does not have a control dependency on the loop head
14+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
int a;
2+
3+
void main(void)
4+
{
5+
int i = 0;
6+
7+
if(i < 10)
8+
{
9+
if(i < 7)
10+
{
11+
a = 1;
12+
}
13+
14+
a = 2;
15+
}
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
main.c
3+
--dependence-graph --show
4+
activate-multi-line-match
5+
EXIT=0
6+
SIGNAL=0
7+
// Second assignment has a control dependency on the outer if
8+
\/\/ ([0-9]+).*\n.*IF.*i < 10.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2
9+
--
10+
^warning: ignoring
11+
// Second assignment does not have a control dependency on the inner if
12+
\/\/ ([0-9]+).*\n.*IF.*i < 7.*THEN(.*\n)*Control dependencies: \1\n(.*\n){2,3}.*a = 2

0 commit comments

Comments
 (0)