cselib: Fix endless cselib loop on (plus:P (reg) (const_int 0))
authorJakub Jelinek <jakub@redhat.com>
Mon, 6 Apr 2020 22:27:10 +0000 (00:27 +0200)
committerJakub Jelinek <jakub@redhat.com>
Mon, 6 Apr 2020 22:27:10 +0000 (00:27 +0200)
commit8662d0593438ecd498ab7591ad0d2810886eb6da
treed872bb10743b0bcf082839852c8a36a7342f1141
parente0fd9ce257c9033d885d9393bc4dc07da1eab16e
cselib: Fix endless cselib loop on (plus:P (reg) (const_int 0))

getopt.c hangs the compiler on h8300-elf with -O2 -g, because the
IL contains addition of constant 0, the first PLUS operand is determined
to have the SP_DERIVED_VALUE_P and the new code in cselib recurses
indefinitely on seeing SP_DERIVED_VALUE_P with locs of
(plus:P SP_DERIVED_VALUE_P (const_int 0)).

Fixed by making sure cselib_subst_to_values canonicalizes it, hashing
already hashes it the same too.

2020-04-06  Jakub Jelinek  <jakub@redhat.com>

* cselib.c (cselib_subst_to_values): For SP_DERIVED_VALUE_P
+ const0_rtx return the SP_DERIVED_VALUE_P.
gcc/ChangeLog
gcc/cselib.c