Skip to content

Commit cf2afea

Browse files
committed
fix: format
1 parent 46569d7 commit cf2afea

File tree

8 files changed

+61
-49
lines changed

8 files changed

+61
-49
lines changed

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/basic-constant-folding.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
//@ description: Pre-pass CP + CFG folds constant branch and simplifies control flow
33
// The `if true` should be folded away by the initial CP + CFG simplification pass,
44
// leaving only the "then" branch.
5-
["if", {"#literal": true}, {"#literal": "then"}, {"#literal": "else"}]
5+
["if", { "#literal": true }, { "#literal": "then" }, { "#literal": "else" }]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/chain-simplification.jsonc

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@
88
// Iter 2: FS propagates `b = true`, CFG folds second if → `c = true`
99
// Iter 3: FS propagates `c = true`, CFG folds final if → "yes"
1010
[
11-
"if", {"#literal": true},
11+
"if",
12+
{ "#literal": true },
1213
[
13-
"let", "a", {"#literal": true},
14+
"let",
15+
"a",
16+
{ "#literal": true },
1417
[
15-
"let", "b", ["if", "a", {"#literal": true}, {"#literal": false}],
18+
"let",
19+
"b",
20+
["if", "a", { "#literal": true }, { "#literal": false }],
1621
[
17-
"let", "c", ["if", "b", {"#literal": true}, {"#literal": false}],
18-
["if", "c", {"#literal": "yes"}, {"#literal": "no"}]
22+
"let",
23+
"c",
24+
["if", "b", { "#literal": true }, { "#literal": false }],
25+
["if", "c", { "#literal": "yes" }, { "#literal": "no" }]
1926
]
2027
]
2128
],
22-
{"#literal": 0}
29+
{ "#literal": 0 }
2330
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/closure-with-dead-branch.jsonc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
// A closure that returns a constant is defined and called with a constant condition.
44
// AR inlines the closure, then CP + CFG simplifies the constant branch.
55
[
6-
"let", "identity",
7-
["fn", {"#tuple": []}, {"#struct": {"x": "Boolean"}}, "_", "x"],
6+
"let",
7+
"identity",
8+
["fn", { "#tuple": [] }, { "#struct": { "x": "Boolean" } }, "_", "x"],
89
[
910
"if",
10-
["identity", {"#literal": true}],
11-
{"#literal": "yes"},
12-
{"#literal": "no"}
11+
["identity", { "#literal": true }],
12+
{ "#literal": "yes" },
13+
{ "#literal": "no" }
1314
]
1415
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/dead-code-after-propagation.jsonc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
// FS propagates `x` into the result, then DSE removes the dead assignment to `dead`.
55
// Wrapped in `if true` to keep as a single body rather than separate thunks.
66
[
7-
"if", {"#literal": true},
8-
[
9-
"let", "x", {"#literal": 42},
10-
["let", "dead", {"#literal": 100}, "x"]
11-
],
12-
{"#literal": 0}
7+
"if",
8+
{ "#literal": true },
9+
["let", "x", { "#literal": 42 }, ["let", "dead", { "#literal": 100 }, "x"]],
10+
{ "#literal": 0 }
1311
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/inst-simplify-with-propagation.jsonc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
// A let binding stores a value that is used in a comparison.
44
// InstSimplify can fold the comparison after FS propagates the constant.
55
[
6-
"let", "x", {"#literal": true},
7-
[
8-
"if", "x",
9-
{"#literal": "was-true"},
10-
{"#literal": "was-false"}
11-
]
6+
"let",
7+
"x",
8+
{ "#literal": true },
9+
["if", "x", { "#literal": "was-true" }, { "#literal": "was-false" }]
1210
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/nested-if-constant.jsonc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
// Multiple levels of constant if-then-else that should all fold away.
44
// Tests that CFG simplification works across multiple iterations.
55
[
6-
"if", {"#literal": true},
6+
"if",
7+
{ "#literal": true },
78
[
8-
"if", {"#literal": false},
9-
{"#literal": "unreachable"},
9+
"if",
10+
{ "#literal": false },
11+
{ "#literal": "unreachable" },
1012
[
11-
"if", {"#literal": true},
12-
{"#literal": "result"},
13-
{"#literal": "also-unreachable"}
13+
"if",
14+
{ "#literal": true },
15+
{ "#literal": "result" },
16+
{ "#literal": "also-unreachable" }
1417
]
1518
],
16-
{"#literal": "outer-else"}
19+
{ "#literal": "outer-else" }
1720
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/nested-let-cleanup.jsonc

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44
// CP propagates used values, DSE removes dead stores, CFG cleans up the result.
55
// Wrapped in `if true` to keep as a single body rather than separate thunks.
66
[
7-
"if", {"#literal": true},
7+
"if",
8+
{ "#literal": true },
89
[
9-
"let", "a", {"#literal": 1},
10+
"let",
11+
"a",
12+
{ "#literal": 1 },
1013
[
11-
"let", "b", {"#literal": 2},
14+
"let",
15+
"b",
16+
{ "#literal": 2 },
1217
[
13-
"let", "c", {"#literal": 3},
14-
[
15-
"let", "unused1", "a",
16-
["let", "unused2", "b", "c"]
17-
]
18+
"let",
19+
"c",
20+
{ "#literal": 3 },
21+
["let", "unused1", "a", ["let", "unused2", "b", "c"]]
1822
]
1923
]
2024
],
21-
{"#literal": 0}
25+
{ "#literal": 0 }
2226
]

libs/@local/hashql/mir/tests/ui/pass/pre_inlining/thunk-with-dead-code.jsonc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
// A thunk (zero-argument closure) is called, and its result used in a branch.
44
// AR inlines the thunk, then the constant propagates and dead code is eliminated.
55
[
6-
"let", "get_flag",
7-
["fn", {"#tuple": []}, {"#struct": {}}, "_", {"#literal": true}],
6+
"let",
7+
"get_flag",
8+
["fn", { "#tuple": [] }, { "#struct": {} }, "_", { "#literal": true }],
89
[
9-
"let", "flag", ["get_flag"],
10+
"let",
11+
"flag",
12+
["get_flag"],
1013
[
11-
"let", "unused", {"#literal": "dead"},
12-
[
13-
"if", "flag",
14-
{"#literal": "active"},
15-
{"#literal": "inactive"}
16-
]
14+
"let",
15+
"unused",
16+
{ "#literal": "dead" },
17+
["if", "flag", { "#literal": "active" }, { "#literal": "inactive" }]
1718
]
1819
]
1920
]

0 commit comments

Comments
 (0)