Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-12-25 Thread Tom de Vries
On 11/09/2017 11:54 AM, Jakub Jelinek wrote: On Wed, Nov 08, 2017 at 06:57:55PM +0100, Jakub Jelinek wrote: On Wed, Nov 08, 2017 at 06:51:34PM +0100, Marek Polacek wrote: Ok, so like this if it passes bootstrap/regtest? Changes from the last patch: 1) false instead of lval for COMPOUND_EXPR an

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-17 Thread Joseph Myers
On Wed, 8 Nov 2017, Jakub Jelinek wrote: > On Wed, Nov 08, 2017 at 06:51:34PM +0100, Marek Polacek wrote: > > > Ok, so like this if it passes bootstrap/regtest? > > > > > > Changes from the last patch: > > > 1) false instead of lval for COMPOUND_EXPR and *COND_EXPR op1/op2 > > > > So... > > Oop

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-09 Thread Jakub Jelinek
On Wed, Nov 08, 2017 at 06:57:55PM +0100, Jakub Jelinek wrote: > On Wed, Nov 08, 2017 at 06:51:34PM +0100, Marek Polacek wrote: > > > Ok, so like this if it passes bootstrap/regtest? > > > > > > Changes from the last patch: > > > 1) false instead of lval for COMPOUND_EXPR and *COND_EXPR op1/op2 >

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Jakub Jelinek
On Wed, Nov 08, 2017 at 06:51:34PM +0100, Marek Polacek wrote: > > Ok, so like this if it passes bootstrap/regtest? > > > > Changes from the last patch: > > 1) false instead of lval for COMPOUND_EXPR and *COND_EXPR op1/op2 > > So... Oops, I've hand-edited it in the patch and then regenerated the

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Marek Polacek
On Wed, Nov 08, 2017 at 06:38:21PM +0100, Jakub Jelinek wrote: > On Wed, Nov 08, 2017 at 05:17:50PM +, Joseph Myers wrote: > > On Wed, 8 Nov 2017, Jakub Jelinek wrote: > > > > > of course only if LVAL is false. Additionally, I've added folding of > > > "foo"[2] into 'o'. We have it in gimple

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Jakub Jelinek
On Wed, Nov 08, 2017 at 05:17:50PM +, Joseph Myers wrote: > On Wed, 8 Nov 2017, Jakub Jelinek wrote: > > > of course only if LVAL is false. Additionally, I've added folding of > > "foo"[2] into 'o'. We have it in gimple-fold.c or so, so that one > > Note that if the 2 there comes from an ov

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Joseph Myers
On Wed, 8 Nov 2017, Jakub Jelinek wrote: > of course only if LVAL is false. Additionally, I've added folding of > "foo"[2] into 'o'. We have it in gimple-fold.c or so, so that one Note that if the 2 there comes from an overflowing expression that's not valid as an extension to constant express

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Jakub Jelinek
On Wed, Nov 08, 2017 at 05:42:07PM +0100, Marek Polacek wrote: > > Not sure about the COND_EXPR/VEC_COND_EXPR cases, right now I'm passing > > false as LVAL for the first operand (condition) and lval as LVAL for the > > other two (i.e. if called with lval == true on the whole *_COND_EXPR > > decl_c

Re: [PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Marek Polacek
On Wed, Nov 08, 2017 at 05:22:45PM +0100, Jakub Jelinek wrote: > Hi! > > Here is an attempt to fix these two PRs. The C++ FE already has an LVAL Nice! > bool that it propagates through constexpr.c functions, or in > cp-gimplify.c through calling cp_fold_{maybe_,}rvalue where appropriate. > The

[PATCH] Add LVAL argument to c_fully_fold* and propagate it through (PR c/66618, PR c/69960)

2017-11-08 Thread Jakub Jelinek
Hi! Here is an attempt to fix these two PRs. The C++ FE already has an LVAL bool that it propagates through constexpr.c functions, or in cp-gimplify.c through calling cp_fold_{maybe_,}rvalue where appropriate. The C c_fully_fold was instead just calling decl_constant_value_for_optimization in som