fold_r, so it seems we need another
flag that that only affects the manifestly constant-eval stuff; I called
it ff_mce_false. How does the following look?
-- >8 --
Subject: [PATCH 2/2] c++: speculative constexpr and
is_constant_evaluated
[PR108243]
This PR illustrates that __builtin_i
,15 @@ cp_fold (tree x)
> > > > > > > >constant, but the call followed by an INDIRECT_REF
> > > > > > > > is. */
> > > > > > > > if (callee && DECL_DECLARED_CONSTEXPR_P (callee)
> &g
+ /* At genericization time it's safe to fold
> > > > > > > + __builtin_is_constant_evaluated to false. */
> > > > > > > + manifestly_const_eval = mce_false;
> > > > > > > + r = maybe_constant_value (x, /*decl=*/NULL_TREE,
> >
> > > if (TREE_CODE (r) != CALL_EXPR)
> > > > > > @@ -2971,7 +2989,7 @@ cp_fold (tree x)
> > > > > > vec *nelts = NULL;
> > > > > > FOR_EACH_VEC_SAFE_ELT (elts, i, p)
> > > > > >
nericize here because that
flag has additional effects in cp_fold_r, so it seems we need another
flag that that only affects the manifestly constant-eval stuff; I called
it ff_mce_false. How does the following look?
-- >8 --
Subject: [PATCH 2/2] c++: speculative constexpr and is_constant_evaluated
gt; > > > - op1 = cp_fold (TREE_OPERAND (x, 1));
> > > > - op2 = cp_fold (TREE_OPERAND (x, 2));
> > > > - op3 = cp_fold (TREE_OPERAND (x, 3));
> > > > + op0 = cp_fold (TREE_OPERAND (x, 0), flags);
> > > > + op1 = cp_fold
fold_init. So it seems
we need to make cp_fold when called from the latter entry point to also
assume m_c_e is false. We can't re-use ff_genericize here because that
flag has additional effects in cp_fold_r, so it seems we need another
flag that that only affects the manifestly constant-ev
= cp_fold (TREE_OPERAND (x, 0));
> > > + r = cp_fold (TREE_OPERAND (x, 0), flags);
> > > if (tree_invariant_p (r))
> > > x = r;
> > > break;
> > > @@ -3069,7 +3087,7 @@ cp_fold (tree x)
> > > copy_warn
(!c.evaluation_restricted_p ())
> > + if (cache_p && !c.evaluation_restricted_p ())
> > {
> > fold_cache->put (org_x, x);
> > /* Prevent that we try to fold an already folded result again. */
> > diff --git a/gcc/testsuite/g++.dg/opt/
On 1/27/23 17:02, Patrick Palka wrote:
This PR illustrates that __builtin_is_constant_evaluated currently acts
as an optimization barrier for our speculative constexpr evaluation,
since we don't want to prematurely fold the builtin to false if the
expression in question would be later manifestly
On Fri, 27 Jan 2023, Patrick Palka wrote:
> This PR illustrates that __builtin_is_constant_evaluated currently acts
> as an optimization barrier for our speculative constexpr evaluation,
> since we don't want to prematurely fold the builtin to false if the
> expression in question would be later
This PR illustrates that __builtin_is_constant_evaluated currently acts
as an optimization barrier for our speculative constexpr evaluation,
since we don't want to prematurely fold the builtin to false if the
expression in question would be later manifestly constant evaluated (in
which case it
12 matches
Mail list logo