c-fold.c (c_fully_fold_internal): Save the c_fully_fold_internal result for SAVE_EXPR operand and set...
* c-fold.c (c_fully_fold_internal): Save the c_fully_fold_internal result for SAVE_EXPR operand and set SAVE_EXPR_FOLDED_P even if it returned invariant. Call tree_invariant_p unconditionally afterwards to decide whether to return expr or op0. From-SVN: r248347
This commit is contained in:
parent
655e52652b
commit
d11c168a67
2 changed files with 13 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
|||
2017-05-22 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* c-fold.c (c_fully_fold_internal): Save the c_fully_fold_internal
|
||||
result for SAVE_EXPR operand and set SAVE_EXPR_FOLDED_P even if
|
||||
it returned invariant. Call tree_invariant_p unconditionally
|
||||
afterwards to decide whether to return expr or op0.
|
||||
|
||||
2017-05-22 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
* c-decl.c (c_parse_final_cleanups): Drop TDI_tu handling.
|
||||
|
|
|
@ -566,21 +566,17 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
|
|||
|
||||
case SAVE_EXPR:
|
||||
/* Make sure to fold the contents of a SAVE_EXPR exactly once. */
|
||||
op0 = TREE_OPERAND (expr, 0);
|
||||
if (!SAVE_EXPR_FOLDED_P (expr))
|
||||
{
|
||||
op0 = TREE_OPERAND (expr, 0);
|
||||
op0 = c_fully_fold_internal (op0, in_init, maybe_const_operands,
|
||||
maybe_const_itself, for_int_const);
|
||||
/* Don't wrap the folded tree in a SAVE_EXPR if we don't
|
||||
have to. */
|
||||
if (tree_invariant_p (op0))
|
||||
ret = op0;
|
||||
else
|
||||
{
|
||||
TREE_OPERAND (expr, 0) = op0;
|
||||
SAVE_EXPR_FOLDED_P (expr) = true;
|
||||
}
|
||||
TREE_OPERAND (expr, 0) = op0;
|
||||
SAVE_EXPR_FOLDED_P (expr) = true;
|
||||
}
|
||||
/* Return the SAVE_EXPR operand if it is invariant. */
|
||||
if (tree_invariant_p (op0))
|
||||
ret = op0;
|
||||
goto out;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue