-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1403 from goblint/yaml-witness-unrolled-loop
Record statement copies during loop unrolling
- Loading branch information
Showing
10 changed files
with
323 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
open GoblintCil | ||
|
||
module CopyOfHashTable = Hashtbl.Make(struct | ||
type t = stmt | ||
(* Identity by physical equality. *) | ||
let equal = (==) | ||
(* Hash only labels and skind (statement itself) because they should remain unchanged between now | ||
and lookup after analysis. | ||
CFG construction modifies sid, succs, preds and fallthrough, which are empty here.*) | ||
let hash (s: stmt) = Hashtbl.hash (s.skind, s.labels) | ||
end) | ||
let copyof = CopyOfHashTable.create 113 | ||
|
||
let find_copyof = CopyOfHashTable.find_opt copyof | ||
|
||
let rec find_original s = | ||
match find_copyof s with | ||
| None -> s | ||
| Some s' -> (find_original [@tailcall]) s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(** Syntactic loop unrolling. *) | ||
|
||
val unroll_loops: GoblintCil.fundec -> int -> unit | ||
(** Unroll loops in a function. | ||
@param totalLoops total number of loops from autotuner *) | ||
|
||
val find_original: GoblintCil.stmt -> GoblintCil.stmt | ||
(** Find original un-unrolled instance of the statement. *) |
13 changes: 13 additions & 0 deletions
13
tests/regression/55-loop-unrolling/11-unrolled-loop-invariant.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
int main() { | ||
int i = 0; | ||
while (i < 10) | ||
i++; | ||
|
||
int j = 0, k = 0; | ||
while (j < 10) { | ||
while (k < 100) | ||
k++; | ||
j++; | ||
} | ||
return 0; | ||
} |
230 changes: 230 additions & 0 deletions
230
tests/regression/55-loop-unrolling/11-unrolled-loop-invariant.t
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
(cram | ||
(deps (glob_files *.c))) | ||
|
||
(cram | ||
(applies_to 11-unrolled-loop-invariant) | ||
(enabled_if %{bin-available:graph-easy}) | ||
(deps | ||
%{bin:cfgDot})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters