From ddd93587efdd85681c3512bbfaa1988ea449d7dc Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 28 May 2015 02:15:03 +0000 Subject: [PATCH] Fix PR66168 From-SVN: r223795 --- gcc/ChangeLog | 6 ++++++ gcc/loop-invariant.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr66168.c | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr66168.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a4571f6352..74be3c707e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-28 Thomas Preud'homme + + PR rtl-optimization/66168 + * loop-invariant.c (move_invariant_reg): Pass dest rather than reg to + can_move_invariant_reg. + 2015-05-27 John David Anglin PR target/66148 diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 85270fe14bc..c4321292b5e 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -1630,7 +1630,7 @@ move_invariant_reg (struct loop *loop, unsigned invno) if (REG_P (reg)) regno = REGNO (reg); - if (!can_move_invariant_reg (loop, inv, reg)) + if (!can_move_invariant_reg (loop, inv, dest)) { reg = gen_reg_rtx_and_attrs (dest); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a1a242e3bb5..84b9fab017e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-28 Thomas Preud'homme + + PR rtl-optimization/66168 + * gcc.c-torture/compile/pr66168.c: New test. + 2015-05-27 Jeff Law PR target/39726 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 00000000000..d6bfc7b44a6 --- /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; + } + } +} -- 2.30.2