From 35cb87f08f29583386330011a26f4e2cdb2efd20 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 20 Apr 2020 12:58:19 -0400 Subject: [PATCH 055/179] FIXME: fold binops --- gcc/analyzer/region-model2.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/analyzer/region-model2.cc b/gcc/analyzer/region-model2.cc index f9aa1e8964f..1d4947b8054 100644 --- a/gcc/analyzer/region-model2.cc +++ b/gcc/analyzer/region-model2.cc @@ -2889,6 +2889,12 @@ svalue2 * region_model2_manager::get_or_create_binop (tree type, enum tree_code op, svalue2 *arg0, svalue2 *arg1) { + /* Folding. */ + if (tree cst0 = arg0->maybe_get_constant ()) + if (tree cst1 = arg1->maybe_get_constant ()) + if (tree result = fold_binary (op, type, cst0, cst1)) + return get_or_create_constant_svalue2 (result); + binop_svalue2::key_t key (type, op, arg0, arg1); if (binop_svalue2 **slot = m_binop_values_map.get (key)) return *slot; -- 2.21.0