+2018-12-07 Jeff Law <law@redhat.com>
+
+ PR middle-end/87813
+ * gimple-ssa-evrp-analyze.h (class evrp_range_analyzer): Add
+ m_update_global_ranges member. Add corresponding argument to ctor.
+ * gimple-ssa-evrp-analyze.c
+ (evrp_range_analyzer::evrp_range_analyzer): Add new argument and
+ initialize m_update_global_ranges.
+ (evrp_range_analyzer::set_ssa_range_info): Assert that we are
+ updating global ranges.
+ (evrp_range_analyzer::record_ranges_from_incoming_edge): Only
+ update global ranges if explicitly requested.
+ (evrp_range_analyzer::record_ranges_from_phis): Similarly.
+ (evrp_range_analyzer::record_ranges_from_stmt): Similarly.
+ * gimple-ssa-evrp.c (evrp_dom_walker): Pass new argument to
+ evrp_range_analyzer ctor.
+ * gimple-ssa-sprintf.c (sprintf_dom_walker): Similarly.
+ * tree-ssa-dom.c (dom_opt_dom_walker): Similarly.
+
2018-12-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64-opts.h (aarch64_sve_vector_bits_enum):
#include "vr-values.h"
#include "gimple-ssa-evrp-analyze.h"
-evrp_range_analyzer::evrp_range_analyzer () : stack (10)
+evrp_range_analyzer::evrp_range_analyzer (bool update_global_ranges)
+ : stack (10), m_update_global_ranges (update_global_ranges)
{
edge e;
edge_iterator ei;
void
evrp_range_analyzer::set_ssa_range_info (tree lhs, value_range *vr)
{
+ gcc_assert (m_update_global_ranges);
+
/* Set the SSA with the value range. */
if (INTEGRAL_TYPE_P (TREE_TYPE (lhs)))
{
continue;
push_value_range (vrs[i].first, vrs[i].second);
if (is_fallthru
+ && m_update_global_ranges
&& all_uses_feed_or_dominated_by_stmt (vrs[i].first, stmt))
{
set_ssa_range_info (vrs[i].first, vrs[i].second);
vr_values->update_value_range (lhs, &vr_result);
/* Set the SSA with the value range. */
- set_ssa_range_info (lhs, &vr_result);
+ if (m_update_global_ranges)
+ set_ssa_range_info (lhs, &vr_result);
}
}
/* Case one. We can just update the underlying range
information as well as the global information. */
vr_values->update_value_range (output, &vr);
- set_ssa_range_info (output, &vr);
+ if (m_update_global_ranges)
+ set_ssa_range_info (output, &vr);
}
else
{
class evrp_range_analyzer
{
public:
- evrp_range_analyzer (void);
+ evrp_range_analyzer (bool update_global_ranges);
~evrp_range_analyzer (void)
{
delete vr_values;
/* STACK holds the old VR. */
auto_vec<std::pair <tree, value_range*> > stack;
+
+ /* True if we are updating global ranges, false otherwise. */
+ bool m_update_global_ranges;
};
#endif /* GCC_GIMPLE_SSA_EVRP_ANALYZE_H */
public:
evrp_dom_walker ()
: dom_walker (CDI_DOMINATORS),
+ evrp_range_analyzer (true),
evrp_folder (evrp_range_analyzer.get_vr_values ())
{
need_eh_cleanup = BITMAP_ALLOC (NULL);
class sprintf_dom_walker : public dom_walker
{
public:
- sprintf_dom_walker () : dom_walker (CDI_DOMINATORS) {}
+ sprintf_dom_walker ()
+ : dom_walker (CDI_DOMINATORS),
+ evrp_range_analyzer (false) {}
~sprintf_dom_walker () {}
edge before_dom_children (basic_block) FINAL OVERRIDE;
+2018-12-07 Jeff Law <law@redhat.com>
+
+ PR middle-end/87813
+ * gcc.c-torture/builtins/strnlen.x: New file to filter -Og from
+ options to test.
+
2018-12-07 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/88349
--- /dev/null
+# At -Og no pass records the global range information
+# necessary to optimize the strnlen calls down to
+# a constant. The framework assumes that the test
+# will never call strnlen when the optimizer is
+# enabled. So we filter out the -Og run here.
+
+set torture_eval_before_compile {
+ if {[string match {*-Og*} "$option"]} {
+ continue
+ }
+}
+
+return 0
+
: dom_walker (direction, REACHABLE_BLOCKS),
m_const_and_copies (const_and_copies),
m_avail_exprs_stack (avail_exprs_stack),
+ evrp_range_analyzer (true),
m_dummy_cond (dummy_cond) { }
virtual edge before_dom_children (basic_block);