From c8489cb3ac89cf2f2bbe819132e02dea37c7a28e Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 13 Apr 2017 12:19:25 -0700 Subject: [PATCH] [spacetime] two big allocators in some profiles Summary: These were showing up as allocation huge amounts of memory on some analysis profiles from OpenSSL using Spacetime. Doesn't hurt to make them allocate less. Reviewed By: jeremydubreil Differential Revision: D4884520 fbshipit-source-id: e79b815 --- infer/src/IR/IntLit.re | 10 ++++++++-- infer/src/IR/Sil.re | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/infer/src/IR/IntLit.re b/infer/src/IR/IntLit.re index 2446ac14b..a53f52add 100644 --- a/infer/src/IR/IntLit.re +++ b/infer/src/IR/IntLit.re @@ -33,8 +33,14 @@ let to_signed (unsigned, i, ptr) => (false, i, ptr) }; -let compare (unsigned1, i1, _) (unsigned2, i2, _) => - [%compare : (bool, Int64.t)] (unsigned1, i1) (unsigned2, i2); +let compare (unsigned1, i1, _) (unsigned2, i2, _) => { + let n = Bool.compare unsigned1 unsigned2; + if (n != 0) { + n + } else { + Int64.compare i1 i2 + } +}; let compare_value (unsigned1, i1, _) (unsigned2, i2, _) => [%compare : (int, Int64.t)] (area unsigned1 i1, i1) (area unsigned2 i2, i2); diff --git a/infer/src/IR/Sil.re b/infer/src/IR/Sil.re index de7779204..0f60744c2 100644 --- a/infer/src/IR/Sil.re +++ b/infer/src/IR/Sil.re @@ -1808,7 +1808,11 @@ let sub_av_add = sub_fav_add; let rec exp_sub_ids (f: Ident.t => Exp.t) exp => switch (exp: Exp.t) { - | Var id => f id + | Var id => + switch (f id) { + | Var id' when Ident.equal id id' => exp + | exp' => exp' + } | Lvar _ => exp | Exn e => let e' = exp_sub_ids f e;