diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-11-05 20:37:51 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-11-05 20:37:51 +0100 |
commit | 50fae5a679990a4bba7dc30de21e6d4132d778fb (patch) | |
tree | e79a1de24f6746538c44940eded0a9ed35e3a3b1 /gcc/loop-unswitch.c | |
parent | 2a0603f1899262a11e21aba32da9a94d6f1129c3 (diff) | |
download | gcc-50fae5a679990a4bba7dc30de21e6d4132d778fb.zip gcc-50fae5a679990a4bba7dc30de21e6d4132d778fb.tar.gz gcc-50fae5a679990a4bba7dc30de21e6d4132d778fb.tar.bz2 |
re PR rtl-optimization/58997 (ICE on valid code at -O3 on x86_64-linux-gnu (affecting gcc trunk and 4.8.2))
PR rtl-optimization/58997
* loop-iv.c (iv_subreg): For IV_UNKNOWN_EXTEND, expect
get_iv_value to be in iv->mode rather than iv->extend_mode.
(iv_extend): Likewise. Otherwise, if iv->extend != extend,
use lowpart_subreg on get_iv_value before calling simplify_gen_unary.
* loop-unswitch.c (may_unswitch_on): Make sure op[i] is in the right
mode.
* gcc.c-torture/compile/pr58997.c: New test.
From-SVN: r204413
Diffstat (limited to 'gcc/loop-unswitch.c')
-rw-r--r-- | gcc/loop-unswitch.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index 3bdb10a..219c943 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -191,6 +191,7 @@ may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn) if (!test) return NULL_RTX; + mode = VOIDmode; for (i = 0; i < 2; i++) { op[i] = XEXP (test, i); @@ -205,11 +206,15 @@ may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn) return NULL_RTX; op[i] = get_iv_value (&iv, const0_rtx); + if (iv.extend != IV_UNKNOWN_EXTEND + && iv.mode != iv.extend_mode) + op[i] = lowpart_subreg (iv.mode, op[i], iv.extend_mode); + if (mode == VOIDmode) + mode = iv.mode; + else + gcc_assert (mode == iv.mode); } - mode = GET_MODE (op[0]); - if (mode == VOIDmode) - mode = GET_MODE (op[1]); if (GET_MODE_CLASS (mode) == MODE_CC) { if (at != BB_END (bb)) |