--- /dev/null
+/* { dg-do run } */
+
+struct X { int counter; };
+
+struct X __attribute__((noipa)) foo (struct X x)
+{
+ x.counter++;
+ if (x.counter == 5)
+ __builtin_exit (0);
+ return x;
+}
+
+int
+main ()
+{
+ struct X x;
+ x.counter = 0;
+ for (int i = 0; i < 10; ++i)
+ x = foo (x);
+ __builtin_abort ();
+}
break;
}
- /* We have visited ourselves already so ignore STMT for the
- purpose of chaining. */
- if (use_stmt == stmt)
- ;
/* In simple cases we can look through PHI nodes, but we
have to be careful with loops and with memory references
containing operands that are also operands of PHI nodes.
See gcc.c-torture/execute/20051110-*.c. */
- else if (gimple_code (use_stmt) == GIMPLE_PHI)
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
/* If we already visited this PHI ignore it for further
processing. */
fail = true;
break;
}
+ /* We have visited ourselves already so ignore STMT for the
+ purpose of chaining. */
+ else if (use_stmt == stmt)
+ ;
/* If this is a store, remember it as we possibly need to walk the
defs uses. */
else if (gimple_vdef (use_stmt))