From ebdf17cb73df8e9759c9fd6d0afc0329c0072cd8 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Wed, 19 Sep 2018 19:38:11 +0200 Subject: [PATCH] combine: Use correct mode in new comparison (PR86902) This code in try_combine uses the wrong mode. This fails (with RTL checking) in trunk, but not in any released branches. PR rtl-optimization/86902 * combine.c (try_combine): When changing the CC mode used, don't change an unrelated mode in other_insn to that new CC mode. From-SVN: r264426 --- gcc/ChangeLog | 6 ++++++ gcc/combine.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cf3d66a6c03..cfd874937b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-09-19 Segher Boessenkool + + PR rtl-optimization/86902 + * combine.c (try_combine): When changing the CC mode used, don't change + an unrelated mode in other_insn to that new CC mode. + 2018-09-19 David Malcolm * tree-data-ref.c (runtime_alias_check_p): Use formatted printing diff --git a/gcc/combine.c b/gcc/combine.c index a2649b6d5a1..60cfe972aaf 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3310,7 +3310,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, { /* Replace cc_use_loc with entire new RTX. */ SUBST (*cc_use_loc, - gen_rtx_fmt_ee (compare_code, compare_mode, + gen_rtx_fmt_ee (compare_code, GET_MODE (*cc_use_loc), newpat_dest, const0_rtx)); undobuf.other_insn = cc_use_insn; } @@ -3319,7 +3319,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, /* Just replace the CC reg with a new mode. */ SUBST (XEXP (*cc_use_loc, 0), newpat_dest); undobuf.other_insn = cc_use_insn; - } + } } /* Now we modify the current newpat: -- 2.30.2