From 7f04b0d786e13ff5c1bd952a24fd324224415c9a Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 11 May 2022 11:53:53 +0200 Subject: Implement some of fold_binary_op_with_conditional_arg in match.pd The following allows (c != 0 ? 0 : 100) != 0 to be simplified as c != 0 as fold_binary_op_with_conditional_arg would have done via forwprop and GENERIC folding. Likewise it allows to combine (a != 0) != 0 directly via match.pd instead of only via forwprop and again fold_binary_op_with_conditional_arg. The patterns do not fully implement all cases of fold_binary_op_with_conditional_arg, some aspects like "any of the operands simplify" cannot currently be expressed. 2022-05-11 Richard Biener * generic-match-head.cc: Include tree-eh.h. * match.pd ((cond ...) cmp X): New simplification inspired by fold_binary_op_with_conditional_arg. (eq/ne (cmp ...) true/false): Likewise. * gcc.dg/tree-ssa/pr61839_1.c: Adjust. * gcc.dg/tree-ssa/vrp24.c: Likewise. --- gcc/generic-match-head.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/generic-match-head.cc') diff --git a/gcc/generic-match-head.cc b/gcc/generic-match-head.cc index e11a736..cb0fbd3 100644 --- a/gcc/generic-match-head.cc +++ b/gcc/generic-match-head.cc @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs-tree.h" #include "dbgcnt.h" #include "tm.h" +#include "tree-eh.h" /* Routine to determine if the types T1 and T2 are effectively the same for GENERIC. If T1 or T2 is not a type, the test -- cgit v1.1