Skip to content

Commit

Permalink
single, more unreachable, snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
rtjoa committed Apr 29, 2024
1 parent 8e14210 commit 17da301
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 31 deletions.
13 changes: 13 additions & 0 deletions dag_in_context/src/greedy_dag_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,18 +542,31 @@ impl CostModel for DefaultCostModel {
| "Infinity"
| "NegInfinity"
| "MkIntInterval"
| "IntersectIntInterval"
| "UnionIntInterval"
| "AddIntIntervalToAll"
| "AddIntInterval"
| "AddIntOrInfinity"
| "AddIntIntervalToPtrPointees"
| "Intersect-PtrPointees"
| "PointsAnywhere"
| "ConsIfNonEmpty"
| "Cons-List<i64+IntInterval>"
| "Nil-List<i64+IntInterval>"
| "Length-List<i64+IntInterval>"
| "Concat-List<i64+IntInterval>"
| "RevConcat-List<i64+IntInterval>"
| "UnionHelper-List<i64+IntInterval>"
| "Union-List<i64+IntInterval>"
| "Cons-List<PtrPointees>"
| "Nil-List<PtrPointees>"
| "Length-List<PtrPointees>"
| "Concat-List<PtrPointees>"
| "RevConcat-List<PtrPointees>"
| "Union-PtrPointees"
| "Zip<Union-PtrPointees>"
| "UnionPointees"
| "UnwrapTuplePointsTo"
| "UnwrapPtrPointsTo"
| "PointeesDropFirst"
| "PointsToCellsAtIter"
Expand Down
3 changes: 3 additions & 0 deletions dag_in_context/src/optimizations/memory.egg
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
((PointsToCells x ap)
(PointsToCells y ap))
:ruleset memory-helpers)
(rule ((PointsToCells (Single x) ap))
((PointsToCells x ap))
:ruleset memory-helpers)

; Compute and propagate PointsToCells
(rewrite (PointsToCells (Concat x y) aps)
Expand Down
8 changes: 4 additions & 4 deletions tests/snapshots/files__fib_recursive-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ source: tests/files.rs
expression: visualization.result
---
@fac(v0: int): int {
v2: int = const 0;
v5: bool = eq v2 v0;
v3: int = const 0;
v5: bool = eq v0 v3;
v9: int = const 1;
br v5 .__51__ .__13__;
.__51__:
v49: int = id v9;
jmp .__54__;
.__13__:
v15: bool = eq v9 v0;
v15: bool = eq v0 v9;
br v15 .__41__ .__22__;
.__41__:
v43: int = call @fac v2;
v43: int = call @fac v3;
v39: int = id v9;
.__47__:
v49: int = id v39;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/files__fib_shape-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ expression: visualization.result
v14: bool = lt v8 v10;
br v14 .__32__ .__21__;
.__32__:
v35: int = add v8 v9;
v35: int = add v9 v8;
v37: bool = const true;
v27: int = id v35;
v28: bool = id v37;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/files__flatten_loop-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ expression: visualization.result
v49: int = id v49;
br v53 .__51__ .__106__;
.__106__:
v109: int = add v45 v46;
v109: int = add v46 v45;
v111: bool = const true;
v32: int = id v109;
v33: bool = id v111;
Expand Down
6 changes: 3 additions & 3 deletions tests/snapshots/files__gamma_condition_and-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ source: tests/files.rs
expression: visualization.result
---
@main(v0: int) {
v2: int = const 0;
v5: bool = lt v2 v0;
v10: bool = lt v0 v2;
v3: int = const 0;
v5: bool = gt v0 v3;
v10: bool = lt v0 v3;
v15: int = const 1;
br v5 .__22__ .__17__;
.__22__:
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/files__implicit-return-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ expression: visualization.result
v20: bool = lt v10 v18;
br v20 .__41__ .__28__;
.__41__:
v44: int = mul v11 v9;
v44: int = mul v9 v11;
v46: bool = const true;
v48: int = const 1;
v51: int = add v48 v10;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/files__loop_if-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ expression: visualization.result
v5: int = id v2;
v6: int = id v2;
.__8__:
v10: bool = eq v5 v6;
v10: bool = eq v6 v5;
br v10 .__34__ .__19__;
.__34__:
v30: int = id v5;
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/files__loop_pass_through-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/files.rs
expression: visualization.result
---
@main(v0: int) {
v3: int = const 1;
v3: int = const 2;
v6: int = id v3;
v7: int = id v0;
.__9__:
Expand Down
11 changes: 5 additions & 6 deletions tests/snapshots/files__mem_loop_redundant_load-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ expression: visualization.result
v22: bool = id v22;
br v22 .__24__ .__32__;
.__32__:
v35: int = const 20;
v38: int = const 10;
store v20 v38;
store v21 v35;
v43: int = load v20;
print v43;
v33: int = const 10;
v36: int = const 20;
store v20 v33;
store v21 v36;
print v33;
free v19;
}
15 changes: 7 additions & 8 deletions tests/snapshots/files__mem_simple_redundant_load-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ expression: visualization.result
@main {
v1: int = const 2;
v4: ptr<int> = alloc v1;
v8: int = const 1;
v10: ptr<int> = ptradd v4 v8;
v12: int = const 20;
v15: int = const 10;
store v4 v15;
store v10 v12;
v20: int = load v4;
print v20;
v6: int = const 10;
v9: int = const 1;
v11: ptr<int> = ptradd v4 v9;
v13: int = const 20;
store v4 v6;
store v11 v13;
print v6;
free v4;
}
6 changes: 3 additions & 3 deletions tests/snapshots/files__small-collatz-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ expression: visualization.result
v17: int = id v10;
v18: int = id v3;
.__20__:
v22: bool = eq v16 v14;
v22: bool = eq v14 v16;
br v22 .__108__ .__32__;
.__108__:
v110: bool = const false;
Expand Down Expand Up @@ -61,8 +61,8 @@ expression: visualization.result
jmp .__118__;
.__56__:
v58: bool = const true;
v62: int = mul v14 v17;
v65: int = add v62 v16;
v63: int = mul v17 v14;
v65: int = add v16 v63;
v71: int = id v49;
v72: bool = id v58;
v73: int = id v65;
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/files__small-fib-optimize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ source: tests/files.rs
expression: visualization.result
---
@main(v0: int) {
v2: int = const 0;
v5: bool = eq v2 v0;
v3: int = const 0;
v5: bool = eq v0 v3;
v8: int = const 1;
print v8;
br v5 .__78__ .__16__;
Expand Down

0 comments on commit 17da301

Please sign in to comment.