public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106912] [13 Regression] ICE in vect_transform_loops, at tree-vectorizer.cc:1032 since r13-1575-gcf3a120084e94614
Date: Fri, 25 Nov 2022 07:59:51 +0000	[thread overview]
Message-ID: <bug-106912-4-UvnjISyx9E@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106912-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106912

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> OK, it's a late IPA pass doing the clones it seems.  The scalar node got the
> 'const' stripped btw, but the call fntype still has it via the attributes.
> 
> It loses 'const' by
> 
> Old value = 252968993
> New value = 251920417
> set_const_flag_1 (node=<cgraph_node * 0x7ffff6530330 "foo"/1>,
> set_const=false, looping=false, changed=0x7fffffffda5f) at
> /home/rguenther/src/trunk/gcc/cgraph.cc:2696
> 2696              DECL_LOOPING_CONST_OR_PURE_P (node->decl) = false;
> (gdb) bt
> #0  set_const_flag_1 (node=<cgraph_node * 0x7ffff6530330 "foo"/1>, 
>     set_const=false, looping=false, changed=0x7fffffffda5f)
>     at /home/rguenther/src/trunk/gcc/cgraph.cc:2696
> #1  0x0000000000da633f in cgraph_node::set_const_flag (
>     this=<cgraph_node * const 0x7ffff6530330 "foo"/1>, set_const=false, 
>     looping=false) at /home/rguenther/src/trunk/gcc/cgraph.cc:2789
> #2  0x00000000015e2910 in tree_profiling ()
>     at /home/rguenther/src/trunk/gcc/tree-profile.cc:818
> #3  0x00000000015e2b9f in (anonymous
> namespace)::pass_ipa_tree_profile::execute
>     (this=0x42a0c70) at /home/rguenther/src/trunk/gcc/tree-profile.cc:888
> 
> but the IL happily continues to treat the calls as 'const' because
> flags_from_decl_or_type on the call fntype has
> 
> 849       else if (TYPE_P (exp))
> 850         {
> 851           if (TYPE_READONLY (exp))
> 852             flags |= ECF_CONST;
> 
> note that __attribute__((pure)) is not duplicated on the type and so the
> IPA profile effect will change the IL in fixup_cfg (), rewriting virtual
> operands there.
> making things consistent.

Just to note, since types are shared we cannot simply strip the attribute
from the function decls type.  If the instead unshare it and do the type
change local to the decl the calls to the function won't pick up this change.

So the only way out here is to never go const -> non-const (or pure ->
non-pure)
because that cannot work reliably (consider indirect calls for example).

  parent reply	other threads:[~2022-11-25  7:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 17:23 [Bug c/106912] New: [13 Regression] ICE in vect_transform_loops, at tree-vectorizer.cc:1032 gscfq@t-online.de
2022-09-12 19:35 ` [Bug tree-optimization/106912] [13 Regression] ICE in vect_transform_loops, at tree-vectorizer.cc:1032 since r13-1575-gcf3a120084e94614 marxin at gcc dot gnu.org
2022-09-13  6:41 ` rguenth at gcc dot gnu.org
2022-09-13  7:47 ` rguenth at gcc dot gnu.org
2022-09-13  8:51 ` rguenth at gcc dot gnu.org
2022-11-25  7:59 ` rguenth at gcc dot gnu.org [this message]
2022-12-08 17:30 ` jakub at gcc dot gnu.org
2022-12-12 10:56 ` rguenth at gcc dot gnu.org
2022-12-20  0:12 ` pinskia at gcc dot gnu.org
2023-02-06 12:11 ` jakub at gcc dot gnu.org
2023-02-06 12:29 ` jakub at gcc dot gnu.org
2023-02-07 11:33 ` rguenth at gcc dot gnu.org
2023-03-16 12:50 ` jakub at gcc dot gnu.org
2023-03-24 12:53 ` cvs-commit at gcc dot gnu.org
2023-03-24 12:54 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106912-4-UvnjISyx9E@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).