Message ID | 20171109195832.GE14653@tucnak |
---|---|
State | New |
Headers | show |
Series | Fix compare-elim.c ICE (PR rtl-optimization/82913) | expand |
> Anyway, this patch doesn't do those smarts, just restores previous behavior. > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2017-11-09 Jakub Jelinek <jakub@redhat.com> > > PR rtl-optimization/82913 > * compare-elim.c (try_merge_compare): Punt if def_insn is not > single set. > > * gcc.c-torture/compile/pr82913.c: New test. OK, thanks.
--- gcc/compare-elim.c.jj 2017-11-01 22:51:37.000000000 +0100 +++ gcc/compare-elim.c 2017-11-09 11:44:18.996213647 +0100 @@ -683,6 +683,8 @@ try_merge_compare (struct comparison *cm rtx_insn *def_insn = cmp->in_a_setter; rtx set = single_set (def_insn); + if (!set) + return false; if (!can_merge_compare_into_arith (cmp_insn, def_insn)) return false; --- gcc/testsuite/gcc.c-torture/compile/pr82913.c.jj 2017-11-09 11:47:18.779031240 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr82913.c 2017-11-09 11:46:59.000000000 +0100 @@ -0,0 +1,23 @@ +/* PR rtl-optimization/82913 */ + +unsigned int a; +unsigned long int b; + +int +foo (void) +{ + ++a; + b = 0; +} + +unsigned long int +bar (int x) +{ + if (!foo () || !a) + { + int c = a != b; + if (c != x) + return a; + } + return 0; +}