Skip to content

Commit

Permalink
Run until fix point
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerhou committed Oct 2, 2024
1 parent 8290332 commit 05924c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
7 changes: 5 additions & 2 deletions tylerhou/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ let command =
eprint_s [%message "no such optimization" (other : string)];
failwith "no such optimization")
in
let rec fixpoint_opt before =
let after = List.fold optimizations ~init:before ~f:(fun bril opt -> opt bril) in
if Bril.Func.equal before after then after else fixpoint_opt after
in
In_channel.input_all In_channel.stdin
|> Yojson.Basic.from_string
|> Bril.from_json
|> List.map ~f:(fun input ->
List.fold optimizations ~init:input ~f:(fun bril opt -> opt bril))
|> List.map ~f:fixpoint_opt
|> Bril.to_json
|> Yojson.Basic.to_string
|> Out_channel.output_string Out_channel.stdout)
Expand Down
15 changes: 4 additions & 11 deletions tylerhou/brench.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,17 @@ extract = 'total_dyn_inst: (\d+)'
[runs.baseline]
pipeline = ["bril2json", "brili -p {args}"]

[runs.dce]
pipeline = [
"bril2json",
"_build/install/default/bin/opt dce",
"brili -p {args}",
]

[runs.valnum]
[runs.valnum-dce]
pipeline = [
"bril2json",
"_build/install/default/bin/opt valnum",
"_build/install/default/bin/opt valnum dce",
"brili -p {args}",
]

[runs.valnum-dce]
[runs.constprop-dce]
pipeline = [
"bril2json",
"_build/install/default/bin/opt valnum dce",
"_build/install/default/bin/opt constprop dce",
"brili -p {args}",
]

Expand Down

0 comments on commit 05924c1

Please sign in to comment.