]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/106617 - fix fold_binary_op_with_conditional_arg pattern issue
authorRichard Biener <rguenther@suse.de>
Thu, 18 Aug 2022 09:10:30 +0000 (11:10 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 18 Aug 2022 14:03:58 +0000 (16:03 +0200)
commitac68f904fe31baf80fa53218f1d8ee033bd8c79b
treed6bf88ac9cd015e6908011b4c174d7569d42ed16
parent03119249b9cfedb48e910b8df6a832b206cced2b
middle-end/106617 - fix fold_binary_op_with_conditional_arg pattern issue

Now that we have parts of fold_binary_op_with_conditional_arg duplicated
in match.pd and are using ! to take or throw away the result we have to
be careful to not have both implementations play games which each other,
causing quadratic behavior.  In particular the match.pd implementation
requires both arms to simplify while the fold-const.cc is happy with
just one arm simplifying (something we cannot express in match.pd).

The fix is to simply not enable the match.pd pattern for GENERIC.

PR middle-end/106617
* match.pd ((a ? b : c) > d -> a ? (b > d) : (c > d)): Fix
guard, disable on GENERIC to not cause quadratic behavior
with the fold-const.cc implementation and the use of !

* gcc.dg/pr106617.c: New testcase.
gcc/match.pd
gcc/testsuite/gcc.dg/pr106617.c [new file with mode: 0644]