Skip to content

Commit 6c6276e

Browse files
authored
Merge pull request #1837 from goblint/termination-unflat
Remove unnecessary flat lifting in `LoopTermination`
2 parents 76714a0 + 6aee315 commit 6c6276e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/analyses/loopTermination.ml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ let ask_bound man varinfo =
1717
| `Lifted v -> `Lifted v
1818
| `Bot -> failwith "Loop counter variable is Bot."
1919

20-
(** We want to record termination information of loops and use the loop
21-
* statements for that. We use this lifting because we need to have a
22-
* lattice. *)
23-
module Statements = Lattice.Flat (CilType.Stmt)
24-
2520
(** The termination analysis considering loops and gotos *)
2621
module Spec : Analyses.MCPSpec =
2722
struct
@@ -37,7 +32,9 @@ struct
3732
include UnitV
3833
let is_write_only _ = true
3934
end
40-
module G = MapDomain.MapBot (Statements) (BoolDomain.MustBool)
35+
36+
(** We want to record termination information of loops and use the loop statements for that. *)
37+
module G = MapDomain.MapBot (CilType.Stmt) (BoolDomain.MustBool)
4138

4239
let startstate _ = ()
4340
let exitstate = startstate
@@ -52,7 +49,7 @@ struct
5249
| Some loop_statement ->
5350
let bound = ask_bound man loop_counter in
5451
let is_bounded = bound <> `Top in
55-
man.sideg () (G.add (`Lifted loop_statement) is_bounded (man.global ()));
52+
man.sideg () (G.add loop_statement is_bounded (man.global ()));
5653
let loc = M.Location.CilLocation (Cilfacade.get_stmtLoc loop_statement) in
5754
begin match bound with
5855
| `Top ->
@@ -75,7 +72,7 @@ struct
7572
| Queries.MustTermLoop loop_statement ->
7673
let multithreaded = man.ask Queries.IsEverMultiThreaded in
7774
(not multithreaded)
78-
&& (BatOption.default false (G.find_opt (`Lifted loop_statement) (man.global ())))
75+
&& (BatOption.default false (G.find_opt loop_statement (man.global ())))
7976
| Queries.MustTermAllLoops ->
8077
let multithreaded = man.ask Queries.IsEverMultiThreaded in
8178
if multithreaded then (

0 commit comments

Comments
 (0)