From d0c3401ab948f0773bc1830e1d120f07df5d08be Mon Sep 17 00:00:00 2001 From: Nicholas Coughlin Date: Fri, 15 Mar 2024 21:36:32 +1000 Subject: [PATCH] Limit CSE to generating bitvec temps --- libASL/transforms.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libASL/transforms.ml b/libASL/transforms.ml index a96a86ea..eee7f8b0 100644 --- a/libASL/transforms.ml +++ b/libASL/transforms.ml @@ -1456,10 +1456,13 @@ module CommonSubExprElim = struct let () = match e with (* For now, only gather TApply's that we've seen more than once See eval_prim in value.ml for the list of what that covers. *) - | Expr_TApply(_) -> - if (List.mem e cand_exprs) && not (List.mem e exprs) then - exprs <- e :: exprs - else cand_exprs <- e :: cand_exprs; + | Expr_TApply(FIdent(f,_),_,_) when List.mem f Value.prims_pure -> + (match infer_type e with + | Some (Type_Bits _) -> + if (List.mem e cand_exprs) && not (List.mem e exprs) then + exprs <- e :: exprs + else cand_exprs <- e :: cand_exprs; + | _ -> ()) | _ -> () in