From 499356939ab2120c4d321437fd12a9a493264f31 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 50b349f5..057cfb88 100644 --- a/libASL/transforms.ml +++ b/libASL/transforms.ml @@ -1448,10 +1448,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