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 1e01806
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 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
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;
}

0 comments on commit 1e01806

Please sign in to comment.