Skip to content

Commit 2f1c2df

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 3a4cd5a commit 2f1c2df

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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 | a = bb.getNode(i) and b = bb.getNode(j) and i < j) and
12+
minA = min(a.getATimestamp()) and
13+
minB = min(b.getATimestamp()) and
14+
minA >= minB
15+
select a, "Basic block ordering: $@ appears before $@", a.getTimestampExpr(minA),
16+
"timestamp " + minA, b.getTimestampExpr(minB), "timestamp " + minB

0 commit comments

Comments
 (0)