Skip to content

Commit 38a0cba

Browse files
authored
Merge pull request #737 from goblint/reanalyze-dce
Run dead code analysis with reanalyze
2 parents 75f6130 + e9bd890 commit 38a0cba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+181
-1215
lines changed

src/analyses/arinc.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,12 @@ struct
625625
| _ -> d
626626

627627
let query ctx (type a) (q: a Queries.t): a Queries.result =
628-
let d = ctx.local in
628+
(* let d = ctx.local in *)
629629
match q with
630-
| Queries.Priority _ ->
630+
(* had this query but nobody asked for it *)
631+
(* | Queries.Priority _ ->
631632
if Pri.is_int d.pri then Queries.ID.of_int IInt @@ BI.of_int64 @@ Option.get @@ Pri.to_int d.pri (* TODO: what ikind to use for priorities? *)
632-
else if Pri.is_top d.pri then Queries.Result.top q else Queries.Result.bot q (* TODO: remove bot *)
633+
else if Pri.is_top d.pri then Queries.Result.top q else Queries.Result.bot q (* TODO: remove bot *) *)
633634
(* | Queries.MayBePublic _ -> *)
634635
(* `Bool ((PrE.to_int d.pre = Some 0L || PrE.to_int d.pre = None) && (not (mode_is_init d.pmo))) *)
635636
| _ -> Queries.Result.top q

src/analyses/base.ml

Lines changed: 69 additions & 127 deletions
Large diffs are not rendered by default.

src/analyses/commonPriv.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ struct
6161
let r = is_protected_by ask m x in
6262
if r then ProtectionLogging.record m x;
6363
r
64-
65-
let is_atomic ask: bool =
66-
ask Q.MustBeAtomic
6764
end
6865

6966
module MutexGlobals =

src/analyses/condVars.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
(** Must equality between variables and logical expressions. *)
2+
(* TODO: unused, what is this analysis? *)
23

34
open Prelude.Ana
45
open Analyses

src/analyses/fileUse.ml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ struct
3939
| [(v,_)] -> Some v
4040
| _ -> None
4141

42-
let query_eq (ask: Queries.ask) exp =
43-
match ask.f (Queries.EqualSet exp) with
44-
| l when not (Queries.ES.is_top l) ->
45-
Queries.ES.elements l
46-
| _ -> []
47-
let print_query_eq ?msg:(msg="") ask exp =
48-
let xs = query_eq ask exp in (* EqualSet -> ExpSet *)
49-
Messages.debug "%s EqualSet %a = [%a]" msg d_exp exp (Pretty.d_list ", " d_exp) xs
5042

5143
(* transfer functions *)
5244
let assign ctx (lval:lval) (rval:exp) : D.t =

src/analyses/libraryFunctions.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ let get_threadsafe_inv_ac name =
563563

564564

565565

566-
let lib_funs = ref (Set.String.of_list ["list_empty"; "__raw_read_unlock"; "__raw_write_unlock"; "spin_trylock"])
566+
let lib_funs = ref (Set.String.of_list ["__raw_read_unlock"; "__raw_write_unlock"; "spin_trylock"])
567567
let add_lib_funs funs = lib_funs := List.fold_right Set.String.add funs !lib_funs
568568
let use_special fn_name = Set.String.mem fn_name !lib_funs
569569

src/analyses/mCP.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ struct
268268
Result.meet a @@ S.query ctx' q
269269
in
270270
match q with
271-
| Queries.PrintFullState ->
272-
ignore (Pretty.printf "Current State:\n%a\n\n" D.pretty ctx.local);
273-
()
274271
| Queries.WarnGlobal g ->
275272
(* WarnGlobal is special: it only goes to corresponding analysis and the argument variant is unlifted for it *)
276273
let (n, g): V.t = Obj.obj g in
@@ -331,7 +328,6 @@ struct
331328
{ ctx with
332329
local = obj d
333330
; context = (fun () -> ctx.context () |> assoc n |> obj)
334-
; postsub= assoc_sub post_all
335331
; global = (fun v -> ctx.global (v_of n v) |> g_to n |> obj)
336332
; split
337333
; sideg = (fun v g -> ctx.sideg (v_of n v) (g_of n g))

src/analyses/malloc_null.ml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ struct
183183

184184
(* Function calls *)
185185

186-
let eval_funvar ctx (fv:exp) : varinfo list =
187-
warn_deref_exp (Analyses.ask_of_ctx ctx) ctx.local fv;
188-
[]
189-
190186
let enter ctx (lval: lval option) (f:fundec) (args:exp list) : (D.t * D.t) list =
191187
let nst = remove_unreachable (Analyses.ask_of_ctx ctx) args ctx.local in
192188
may (fun x -> warn_deref_exp (Analyses.ask_of_ctx ctx) ctx.local (Lval x)) lval;

src/analyses/mutexAnalysis.ml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,6 @@ struct
143143
event ctx e octx (* delegate to must lockset analysis *)
144144
end
145145

146-
module MyParam =
147-
struct
148-
module G = LockDomain.Simple
149-
let effect_fun ?write:(w=false) ls = Lockset.export_locks ls
150-
let check_fun = effect_fun
151-
end
152-
153146
module WriteBased =
154147
struct
155148
module GReadWrite =
@@ -163,12 +156,12 @@ struct
163156
let name () = "write"
164157
end
165158
module G = Lattice.Prod (GReadWrite) (GWrite)
166-
let effect_fun ?write:(w=false) ls =
159+
let effect_fun ?(write=false) ls =
167160
let locks = Lockset.export_locks ls in
168-
(locks, if w then locks else Mutexes.top ())
169-
let check_fun ?write:(w=false) ls =
161+
(locks, if write then locks else Mutexes.top ())
162+
let check_fun ?(write=false) ls =
170163
let locks = Lockset.export_locks ls in
171-
if w then (Mutexes.bot (), locks) else (locks, Mutexes.bot ())
164+
if write then (Mutexes.bot (), locks) else (locks, Mutexes.bot ())
172165
end
173166

174167
module Spec = MakeSpec (WriteBased)

0 commit comments

Comments
 (0)