diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c index 086fbc7..ed841a1 100644 --- a/gcc/compare-elim.c +++ b/gcc/compare-elim.c @@ -631,7 +631,16 @@ try_validate_parallel (rtx set_a, rtx set_b) rtx_insn *insn; insn = gen_rtx_INSN (VOIDmode, 0, 0, 0, par, 0, -1, 0); - return recog_memoized (insn) > 0 ? par : NULL_RTX; + if (recog_memoized (insn) > 0) + { + extract_insn (insn); + + return constrain_operands (reload_completed, + get_enabled_alternatives (insn)) + ? par : NULL_RTX; + } + + return NULL_RTX; } /* For a comparison instruction described by CMP check if it compares a diff --git a/gcc/testsuite/gcc.dg/pr82597.c b/gcc/testsuite/gcc.dg/pr82597.c new file mode 100644 index 0000000..98ae264 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr82597.c @@ -0,0 +1,40 @@ +/* PR rtl-optimization/82597 */ +/* { dg-do compile }*/ +/* { dg-options "-O2 -funroll-loops" } */ + +int pb; + +void +ch (unsigned char np, char fc) +{ + unsigned char *y6 = &np; + + if (fc != 0) + { + unsigned char *z1 = &np; + + for (;;) + if (*y6 != 0) + for (fc = 0; fc < 12; ++fc) + { + int hh; + int tp; + + if (fc != 0) + hh = (*z1 != 0) ? fc : 0; + else + hh = pb; + + tp = fc > 0; + if (hh == tp) + *y6 = 1; + } + } + + if (np != 0) + y6 = (unsigned char *)&fc; + if (pb != 0 && *y6 != 0) + for (;;) + { + } +} -- 1.9.1