RE: [PATCH]middle-end fix floating out of constants in conditionals

2022-10-17 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Richard Biener > Sent: Monday, September 26, 2022 11:28 AM > To: Tamar Christina > Cc: gcc-patches@gcc.gnu.org; nd ; jeffreya...@gmail.com; > ebotca...@adacore.com > Subject: Re: [PATCH]middle-end fix floating out of constants in conditi

Re: [PATCH]middle-end fix floating out of constants in conditionals

2022-09-26 Thread Eric Botcazou via Gcc-patches
> Before my change we had always done the folding *only* for TREE_CONSTANT > (arg) and my change allowed it for some cases of !TREE_CONSTANT (arg), but > I did not want to touch the !TREE_CONSTANT (arg) case at all: ...to touch the TREE_CONSTANT (arg) case at all... -- Eric Botcazou

Re: [PATCH]middle-end fix floating out of constants in conditionals

2022-09-26 Thread Eric Botcazou via Gcc-patches
> I think the better fix would be to only consider TREE_CONSTANT (arg) > if it wasn't constant initially. Because clearly "simplify" intends > to be "constant" here. In fact I wonder why we test !TREE_CONSTANT (arg) > at all, we don't simplify 'arg' ... > > Eric added this test (previosuly we'd

Re: [PATCH]middle-end fix floating out of constants in conditionals

2022-09-26 Thread Richard Biener via Gcc-patches
On Fri, 23 Sep 2022, Tamar Christina wrote: > Hi All, > > The following testcase: > > int zoo1 (int a, int b, int c, int d) > { >return (a > b ? c : d) & 1; > } > > gets de-optimized by the front-end since somewhere around GCC 4.x due to a fix > that was added to

Re: [PATCH]middle-end fix floating out of constants in conditionals

2022-09-24 Thread Jeff Law via Gcc-patches
On 9/23/22 03:21, Tamar Christina wrote: Hi All, The following testcase: int zoo1 (int a, int b, int c, int d) { return (a > b ? c : d) & 1; } gets de-optimized by the front-end since somewhere around GCC 4.x due to a fix that was added to fold_binary_op_with_conditional_arg. The

[PATCH]middle-end fix floating out of constants in conditionals

2022-09-23 Thread Tamar Christina via Gcc-patches
Hi All, The following testcase: int zoo1 (int a, int b, int c, int d) { return (a > b ? c : d) & 1; } gets de-optimized by the front-end since somewhere around GCC 4.x due to a fix that was added to fold_binary_op_with_conditional_arg. The folding is supposed to succeed only if we have