Message ID | 000001d0921d$003785d0$00a69170$@arm.com |
---|---|
State | New |
Headers | show |
On Tue, May 19, 2015 at 12:17 PM, Thomas Preud'homme wrote: > 2015-05-18 Thomas Preud'homme > > PR rtl-optimization/66168 > * loop-invariant.c (move_invariant_reg): Set inv->reg to destination > of inv->insn when moving an invariant without introducing a temporary > register. Not OK. This will break in move_invariants() when it looks at REGNO (inv->reg). Ciao! Steven
> From: Steven Bosscher [mailto:stevenb.gcc@gmail.com] > Sent: Tuesday, May 19, 2015 7:21 PM > > Not OK. > This will break in move_invariants() when it looks at REGNO (inv->reg). Indeed. I'm even surprised all tests passed. Ok I will just prevent moving in such a case. I'm running the tests now and will get back to you tomorrow. Best regards, Thomas
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 76a009f..30e1945 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -1642,9 +1642,13 @@ move_invariant_reg (struct loop *loop, unsigned invno) emit_insn_after (gen_move_insn (dest, reg), inv->insn); } - else if (dump_file) - fprintf (dump_file, "Invariant %d moved without introducing a new " - "temporary register\n", invno); + else + { + reg = SET_DEST (set); + if (dump_file) + fprintf (dump_file, "Invariant %d moved without introducing a new " + "temporary register\n", invno); + } reorder_insns (inv->insn, inv->insn, BB_END (preheader)); /* If there is a REG_EQUAL note on the insn we just moved, and the diff --git a/gcc/testsuite/gcc.c-torture/compile/pr66168.c b/gcc/testsuite/gcc.c-torture/compile/pr66168.c new file mode 100644 index 0000000..d6bfc7b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr66168.c @@ -0,0 +1,15 @@ +int a, b; + +void +fn1 () +{ + for (;;) + { + for (b = 0; b < 3; b++) + { + char e[2]; + char f = e[1]; + a ^= f ? 1 / f : 0; + } + } +}