Skip to content

Commit 91f74ce

Browse files
committed
Python: Add BasicBlockOrdering test
This one demonstrates a bug in the current CFG. In a dictionary comprehension `{k: v for k, v in d.items()}`, we evaluate the value before the key, which is incorrect. (A fix for this bug has been implemented in a separate PR.)
1 parent d29fa6f commit 91f74ce

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| test_comprehensions.py:21:29:21:40 | ControlFlowNode for BinaryExpr | Basic block ordering: $@ appears before $@ | test_comprehensions.py:21:35:21:35 | IntegerLiteral | timestamp 9 | test_comprehensions.py:21:21:21:21 | IntegerLiteral | timestamp 8 |
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Checks that within a single basic block, annotations appear in
3+
* increasing minimum-timestamp order.
4+
*/
5+
6+
import python
7+
import TimerUtils
8+
9+
from TimerCfgNode a, TimerCfgNode b, int minA, int minB
10+
where
11+
exists(BasicBlock bb, int i, int j |
12+
a = bb.getNode(i) and b = bb.getNode(j) and i < j
13+
) and
14+
minA = min(a.getATimestamp()) and
15+
minB = min(b.getATimestamp()) and
16+
minA >= minB
17+
select a,
18+
"Basic block ordering: $@ appears before $@",
19+
a.getTimestampExpr(minA), "timestamp " + minA,
20+
b.getTimestampExpr(minB), "timestamp " + minB

0 commit comments

Comments
 (0)