Hello,
Here we're looping because we decrease the counter of the insns we still
can issue on a DEBUG_INSN thus rendering the counter negative. The fix is
to not count debug insns in the corresponding code. The selective
scheduling is known to spoil the result of var tracking, but still it is
not the reason to hang in there.
The toggle option used in the test seems to be the equivalent of just
enabling var-tracking-assignments which should lead to the same situation;
however, if specified as is, var-tracking-assignments will be disabled by
the toplev.c:1460 code. Maybe we also need the same treatment for
flag_var_tracking_assignments_toggle.
Ok for trunk?
gcc/
2016-03-14 Andrey Belevantsev <a...@ispras.ru>
PR rtl-optimization/63384
* sel-sched.c (invoke_aftermath_hooks): Do not decrease issue_more on
DEBUG_INSN_P insns.
testsuite/
2016-03-14 Andrey Belevantsev <a...@ispras.ru>
PR rtl-optimization/63384
* testsuite/g++.dg/pr63384.C: New test.
Best,
Andrey
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index c798935..893a3e5 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4249,7 +4249,8 @@ invoke_aftermath_hooks (fence_t fence, rtx_insn *best_insn, int issue_more)
issue_more);
memcpy (FENCE_STATE (fence), curr_state, dfa_state_size);
}
- else if (GET_CODE (PATTERN (best_insn)) != USE
+ else if (! DEBUG_INSN_P (best_insn)
+ && GET_CODE (PATTERN (best_insn)) != USE
&& GET_CODE (PATTERN (best_insn)) != CLOBBER)
issue_more--;
diff --git a/gcc/testsuite/g++.dg/pr63384.C b/gcc/testsuite/g++.dg/pr63384.C
new file mode 100644
index 0000000..b4e0784
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr63384.C
@@ -0,0 +1,12 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -fsel-sched-reschedule-pipelined -fvar-tracking-assignments-toggle -ftree-vectorize" } */
+
+template <class T> T **make_test_matrix() {
+ T **data = new T *;
+ for (int i = 0; i < 1000; i++)
+ ;
+}
+
+template <typename T> void test() { T **c = make_test_matrix<T>(); }
+
+main() { test<float>(); }