From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
owner@gcc.gnu.org] On Behalf Of Thomas Preud'homme
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.
Patch is now tested via bootstrap + testsuite run on x86_64-linux-gnu and
building arm-none-eabi cross-compiler + testsuite run. Both testsuite run
show no regression.
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 76a009f..4ce3576 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -1626,7 +1626,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))