From cb596fd43667f92c4cb037a4ee8b2061c393ba60 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 28 Oct 2021 13:31:17 -0400 Subject: Perform on-entry propagation after range_of_stmt on a gcond. Propagation is automatically done by the temporal cache when defs are out of date from the names on the RHS, but a gcond has no LHS, and any updates on the RHS are never propagated. Always propagate them. gcc/ PR tree-optimization/102983 * gimple-range-cache.h (propagate_updated_value): Make public. * gimple-range.cc (gimple_ranger::range_of_stmt): Propagate exports when processing gcond stmts. gcc/testsuite/ * gcc.dg/pr102983.c: New. --- gcc/gimple-range.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gcc/gimple-range.cc') diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 91bacda..2c9715a 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -256,7 +256,17 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name) // If no name, simply call the base routine. if (!name) - res = fold_range_internal (r, s, NULL_TREE); + { + res = fold_range_internal (r, s, NULL_TREE); + if (res && is_a (s)) + { + // Update any exports in the cache if this is a gimple cond statement. + tree exp; + basic_block bb = gimple_bb (s); + FOR_EACH_GORI_EXPORT_NAME (m_cache.m_gori, bb, exp) + m_cache.propagate_updated_value (exp, bb); + } + } else if (!gimple_range_ssa_p (name)) res = get_tree_range (r, name, NULL); // Check if the stmt has already been processed, and is not stale. -- cgit v1.1