{
if (m_globals.get_global_range (r, name))
{
- if (m_temporal->current_p (name, depend1 (name), depend2 (name)))
+ // Use this value if the range is constant or current.
+ if (r.singleton_p ()
+ || m_temporal->current_p (name, depend1 (name), depend2 (name)))
return true;
}
else
// undefined. Propagation works better with constants. PR 100512.
// Pointers which resolve to non-zero also do not need
// tracking in the cache as they will never change. See PR 98866.
- // Otherwise mark the value as up-to-date.
+ // Timestamp must always be updated, or dependent calculations may
+ // not include this latest value. PR 100774.
+
if (r.singleton_p ()
|| (POINTER_TYPE_P (TREE_TYPE (name)) && r.nonzero_p ()))
- {
- set_range_invariant (name);
- m_temporal->set_always_current (name);
- }
- else
- m_temporal->set_timestamp (name);
+ set_range_invariant (name);
+ m_temporal->set_timestamp (name);
}
// Push a request for a new lookup in block BB of name. Return true if
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-forwprop --param=evrp-mode=ranger -fcompare-debug " } */
+
+extern void __attribute__((noreturn)) error();
+
+int x;
+
+static inline int bar(void) {
+ char n = 1;
+ int i = x & 1U << n - 1;
+ return i;
+}
+
+void foo()
+{
+ int a = bar();
+ for (;;) {
+ bool b;
+ int d = a;
+ b = a < 2;
+ if (!b)
+ error();
+ }
+}