From: Andrew MacLeod Date: Fri, 16 Oct 2020 19:06:44 +0000 (-0400) Subject: Don't invoke range_of_expr multiple times. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aabc96c9195892e669b7728b0e00a7c1a6f3d161;p=gcc.git Don't invoke range_of_expr multiple times. Call evrp_folder::range_of_expr directly so we dont end up calling hybrid_folder::range_of_expr and doing double lookups/comparisons. * gimple-ssa-evrp.c (hybrid_folder::value_on_edge): Call evrp_folder::value_of_expr directly. (hybrid_folder::value_of_stmt): Ditto. --- diff --git a/gcc/gimple-ssa-evrp.c b/gcc/gimple-ssa-evrp.c index 7688e4aa4bd..309cdd94c21 100644 --- a/gcc/gimple-ssa-evrp.c +++ b/gcc/gimple-ssa-evrp.c @@ -239,7 +239,9 @@ hybrid_folder::value_of_expr (tree op, gimple *stmt) tree hybrid_folder::value_on_edge (edge e, tree op) { - tree evrp_ret = evrp_folder::value_on_edge (e, op); + // Call evrp::value_of_expr directly. Otherwise another dual call is made + // via hybrid_folder::value_of_expr, but without an edge. + tree evrp_ret = evrp_folder::value_of_expr (op, NULL); tree ranger_ret = m_ranger->value_on_edge (e, op); return choose_value (evrp_ret, ranger_ret); } @@ -247,7 +249,14 @@ hybrid_folder::value_on_edge (edge e, tree op) tree hybrid_folder::value_of_stmt (gimple *stmt, tree op) { - tree evrp_ret = evrp_folder::value_of_stmt (stmt, op); + // Call evrp::value_of_expr directly. Otherwise another dual call is made + // via hybrid_folder::value_of_expr, but without a stmt. + tree evrp_ret; + if (op) + evrp_ret = evrp_folder::value_of_expr (op, NULL); + else + evrp_ret = NULL_TREE; + tree ranger_ret = m_ranger->value_of_stmt (stmt, op); return choose_value (evrp_ret, ranger_ret); }