This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ delayed folding branch review
- From: Jason Merrill <jason at redhat dot com>
- To: Kai Tietz <ktietz70 at googlemail dot com>
- Cc: Kai Tietz <ktietz at redhat dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 3 Aug 2015 11:39:23 -0400
- Subject: Re: C++ delayed folding branch review
- Authentication-results: sourceware.org; auth=none
- References: <557A5214 dot 7060106 at redhat dot com> <CAEwic4ZQomb_en7o4=n40j8cHU6-TXmhoSOZZOshiw1Pkgi0Bg at mail dot gmail dot com> <CAEwic4YufFNkdjaXxW0e1ExaGJk0xWwT8FJfiekJWa_mzVsxOQ at mail dot gmail dot com> <55B911DD dot 30105 at redhat dot com> <CAEwic4Z-MgOwdyY_GTP+hGrK6qHgRoys8d4Tj_kHMri7oGuqHQ at mail dot gmail dot com> <55BA5667 dot 9040200 at redhat dot com> <CAEwic4apQgQzSWU6Rbyn-OnBqTu_ADrCm-2Fsc2iPsm_NhUr_g at mail dot gmail dot com> <55BAACF9 dot 7040707 at redhat dot com> <597173047 dot 4338388 dot 1438379666336 dot JavaMail dot zimbra at redhat dot com> <55BEE4CE dot 9070706 at redhat dot com> <CAEwic4aQeu6c88q+RfZ=mGu6tObjzq9tWR4YgRnxCjk2PG=cXQ at mail dot gmail dot com>
On 08/03/2015 05:42 AM, Kai Tietz wrote:
2015-08-03 5:49 GMT+02:00 Jason Merrill <jason@redhat.com>:
On 07/31/2015 05:54 PM, Kai Tietz wrote:
The "STRIP_NOPS-requirement in 'reduced_constant_expression_p'" I could
remove, but for one case in constexpr. Without folding we don't do
type-sinking/raising.
Right.
So binary/unary operations might be containing cast, which were in the
past unexpected.
Why aren't the casts folded away?
On such cast constructs, as for this vector-sample, we can't fold away
Which testcase is this?
the cast chain. The difference here to none-delayed-folding branch is
that the cast isn't moved out of the plus-expr. What we see now is
(plus ((vec) (const vector ...) { .... }), ...). Before we had (vec)
(plus (const vector ...) { ... }).
How could a PLUS_EXPR be considered a reduced constant, regardless of
where the cast is?
On verify_constant we check by reduced_constant_expression_p, if value is
a constant. We don't handle here, that NOP_EXPRs are something we want to
look through here, as it doesn't change anything if this is a constant, or
not.
NOPs around constants should have been folded away by the time we get there.
Not in this cases, as the we actually have here a switch from const to
none-const. So there is an attribute-change, which we can't ignore in
general.
I wasn't suggesting we ignore it, we should be able to change the type
of the vector_cst.
But I agree that for constexpr's we could special case cast
from const to none-const (as required in expressions like const vec v
= v + 1).
Right. But really this should happen in convert.c, it shouldn't be
specific to C++.
Jason