Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer analysis and store forwarding (remove loads after writes) #434

Merged
merged 56 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3b03b93
memory wip
rtjoa Apr 5, 2024
932e105
Add initial pass at redundant load elimination
ezrosent Apr 7, 2024
4a230dc
add TuplesPointsToArgsAtIter0
rtjoa Apr 10, 2024
af8fb67
disable brilift for now
ezrosent Apr 7, 2024
b56df6a
Revert "disable brilift for now"
rtjoa Apr 10, 2024
6dd1044
fix alloc type
rtjoa Apr 10, 2024
bd4dfce
fix memory tests
rtjoa Apr 11, 2024
f8c621e
PointsToCells and DontAlias don't need a state edge
rtjoa Apr 12, 2024
a4b6335
memory: fix ptraddr rules
rtjoa Apr 12, 2024
33c08dc
add failing pqrs test
rtjoa Apr 15, 2024
a759529
wip memory
rtjoa Apr 17, 2024
abad223
memory wip before metaprogramming list
rtjoa Apr 17, 2024
cbcbd83
metaprogram lists and alists for memory
rtjoa Apr 18, 2024
33b81a4
basic loop test working
rtjoa Apr 18, 2024
93518f5
clean up memory
rtjoa Apr 18, 2024
2ba9658
Merge branch 'main' into memory
rtjoa Apr 18, 2024
1638110
fix up memory
rtjoa Apr 19, 2024
e43ebd4
remove extra file
rtjoa Apr 19, 2024
6c39ebc
before refactor
rtjoa Apr 19, 2024
00cf4a1
clean up memory
rtjoa Apr 19, 2024
6818243
use interval analysis
rtjoa Apr 19, 2024
c4a6350
fix sched
rtjoa Apr 19, 2024
dcead18
Merge branch 'main' into memory
rtjoa Apr 19, 2024
9d15245
make PointsToExpr unextractable
rtjoa Apr 19, 2024
8400cd5
bril wip
rtjoa Apr 23, 2024
27f6d28
Merge branch 'main' into memory
rtjoa Apr 23, 2024
af995ee
Merge branch 'main' into memory
rtjoa Apr 23, 2024
cb500eb
add missing free rule
rtjoa Apr 24, 2024
7979bd2
Merge branch 'main' into memory
rtjoa Apr 24, 2024
07521b4
add mem_simple_redundant_load
rtjoa Apr 24, 2024
1602e47
remove warnings
rtjoa Apr 24, 2024
1aeceea
add succ to avoid quadratic query
rtjoa Apr 24, 2024
e595acd
make succ unextractable
rtjoa Apr 24, 2024
9e2125b
update other snapshots
rtjoa Apr 24, 2024
bc76e76
Merge branch 'main' into memory
rtjoa Apr 24, 2024
0836a89
Merge branch 'main' into memory
rtjoa Apr 24, 2024
6ba778b
small snapshot changes
rtjoa Apr 25, 2024
e75a2cc
memory helpers, missing rule, bril loop mem test
rtjoa Apr 25, 2024
d9b06d6
Merge branch 'main' into memory
rtjoa Apr 26, 2024
6476aff
fix memory tests
rtjoa Apr 26, 2024
59e9be6
Merge branch 'main' into memory
rtjoa Apr 28, 2024
66ee407
memory???
rtjoa Apr 29, 2024
0aee86e
pointerish
rtjoa Apr 29, 2024
a1f3ccc
add mem stuff to greedy dag extractor
rtjoa Apr 29, 2024
8455afe
fix nit
rtjoa Apr 29, 2024
f3bd859
update snaps
rtjoa Apr 29, 2024
fa5ed1e
mem
rtjoa Apr 29, 2024
5825868
Merge branch 'main' into memory
rtjoa Apr 29, 2024
8e27ec6
add mem to sched
rtjoa Apr 29, 2024
8d684f4
more unreachable
rtjoa Apr 29, 2024
1167187
more more unreachable
rtjoa Apr 29, 2024
8e14210
fix nits
rtjoa Apr 29, 2024
1e01806
single, more unreachable, snapshots
rtjoa Apr 29, 2024
dc89332
Merge branch 'main' into memory
rtjoa Apr 29, 2024
fd0cccd
even more unreachable
rtjoa Apr 29, 2024
0a087f7
update snaps
rtjoa Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dag_in_context/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ pub fn not(e: RcExpr) -> RcExpr {
RcExpr::new(Expr::Uop(UnaryOp::Not, e))
}

pub fn alloc(id: i64, amount: RcExpr, state: RcExpr, value_ty: BaseType) -> RcExpr {
RcExpr::new(Expr::Alloc(id, amount, state, value_ty))
pub fn alloc(id: i64, amount: RcExpr, state: RcExpr, pointer_ty: BaseType) -> RcExpr {
RcExpr::new(Expr::Alloc(id, amount, state, pointer_ty))
}

pub fn free(ptr: RcExpr, state: RcExpr) -> RcExpr {
Expand Down
55 changes: 54 additions & 1 deletion dag_in_context/src/greedy_dag_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,60 @@ impl CostModel for DefaultCostModel {
"DoWhile" => 100., // TODO: we could make this more accurate
"If" | "Switch" => 50.,
// Unreachable
"HasType" | "HasArgType" | "ContextOf" | "NoContext" | "ExpectType" => 0.,
"I"
| "Infinity"
| "NegInfinity"
| "AddIntOrInfinity"
| "MaxIntOrInfinity"
| "MinIntOrInfinity"
| "MkIntInterval"
| "IntersectIntInterval"
| "UnionIntInterval"
| "AddIntIntervalToAll"
| "AddIntInterval"
| "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>"
| "Rev-List<i64+IntInterval>"
| "UnionHelper-List<i64+IntInterval>"
| "Union-List<i64+IntInterval>"
| "IntersectHelper-List<i64+IntInterval>"
| "Intersect-List<i64+IntInterval>"
| "Cons-List<PtrPointees>"
| "Nil-List<PtrPointees>"
| "Length-List<PtrPointees>"
| "Concat-List<PtrPointees>"
| "RevConcat-List<PtrPointees>"
| "Rev-List<PtrPointees>"
| "Union-PtrPointees"
| "Zip<Union-PtrPointees>"
| "Zip<Intersect-PtrPointees>"
| "UnionPointees"
| "IntersectPointees"
| "UnwrapTuplePointsTo"
| "UnwrapPtrPointsTo"
| "PointeesDropFirst"
| "PointsToCellsAtIter"
| "PtrPointsTo"
| "TuplePointsTo"
| "GetPointees"
| "TypeToPointees"
| "PointsTo"
| "BaseTypeToPtrPointees"
| "TypeListToList<PtrPointees>"
| "HasType"
| "HasArgType"
| "ContextOf"
| "NoContext"
| "CellHasValues"
| "PointsToExpr"
| "ExpectType" => 0.,
"ExprIsPure" | "ListExprIsPure" | "BinaryOpIsPure" | "UnaryOpIsPure" => 0.,
"BodyContainsExpr" | "ScopeContext" => 0.,
"Region" | "Full" | "IntB" | "BoolB" => 0.,
Expand Down
2 changes: 2 additions & 0 deletions dag_in_context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub fn prologue() -> String {
include_str!("utility/canonicalize.egg"),
include_str!("interval_analysis.egg"),
include_str!("optimizations/switch_rewrites.egg"),
&optimizations::memory::rules(),
include_str!("optimizations/memory.egg"),
&optimizations::loop_invariant::rules().join("\n"),
include_str!("optimizations/loop_simplify.egg"),
include_str!("optimizations/loop_unroll.egg"),
Expand Down
Loading
Loading