]> git.ipfire.org Git - thirdparty/gcc.git/commit
MATCH: Make zero_one_valued_p non-recursive fully
authorAndrew Pinski <apinski@marvell.com>
Sun, 17 Sep 2023 18:20:36 +0000 (11:20 -0700)
committerAndrew Pinski <apinski@marvell.com>
Mon, 18 Sep 2023 20:45:35 +0000 (13:45 -0700)
commit7ea501d3ea698e1c845fb61e3487f4cd949e6253
tree5abc352ce405662ffebe81270253815ffb8a889c
parent951d3c191d01440ad54415f683437770b0c957e4
MATCH: Make zero_one_valued_p non-recursive fully

So it turns out VN can't handle any kind of recursion for match. In this
case we have `b = a & -1` and we try to match a as being zero_one_valued_p
and VN returns b as being the value and we just go into an infinite loop at
this point.

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

Note genmatch should warn (or error out) if this gets detected so I filed PR 111446
which I will be looking into next week or the week after so we don't run into
this issue again.

PR tree-optimization/111442

gcc/ChangeLog:

* match.pd (zero_one_valued_p): Have the bit_and match not be
recursive.

gcc/testsuite/ChangeLog:

* gcc.c-torture/compile/pr111442-1.c: New test.
gcc/match.pd
gcc/testsuite/gcc.c-torture/compile/pr111442-1.c [new file with mode: 0644]