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/114151] [14 Regression] weird and inefficient codegen and addressing modes since r14-9193
Date: Fri, 08 Mar 2024 10:13:49 +0000	[thread overview]
Message-ID: <bug-114151-4-F9bl2o0euB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114151-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #12)
> 
> all VRP passes are the same now. so just schedule EVRP.   in theory, you
> could schedule the fast vrp pass I added, but its not heavily tested... but
> you could try it.  It doesnt do any back edges or switches (iirc), but does
> basic calculations in DOM order and exports/updates globals.
> 
> NEXT_PASS (pass_fast_vrp)

When I just want to update global ranges what do I do?  It looks like
VRP first and foremost calls range_of_stmt on each PHI and stmt in the
pre-fold hook.  Does that update global ranges?  It should at least
fill the cache so SCEV would pick up ranges, right?

So doing in the vectorizer sth like the following should get us the best
possible ranges?  Ah, probably only global ranges since the SCEV query
itself would still lack context sensitive info (but as said we don't have
a good context we can easily use).

Would doing sth like below gain anything in addition to your proposed
patch (for context-less queries like those done in SCEV)?

@@ -1240,6 +1241,37 @@ pass_vectorize::execute (function *fun)
   if (vect_loops_num <= 1)
     return 0;

+      scev_reset ();
+  auto ranger = enable_ranger (fun);
+
+    {
+      basic_block bb;
+      FOR_EACH_BB_FN (bb, fun)
+       {
+         for (auto gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next
(&gsi))
+           {
+             tree name = gimple_range_ssa_p (PHI_RESULT (*gsi));
+             if (name)
+               {
+                 Value_Range vr(TREE_TYPE (name));
+                 ranger->range_of_stmt (vr, *gsi, name);
+               }
+           }
+         for (auto gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+           {
+             gimple *s = *gsi;
+             if (is_gimple_debug (s))
+               continue;
+             tree type = gimple_range_type (s);
+             if (type)
+               {
+                 Value_Range vr(type);
+                 ranger->range_of_stmt (vr, s);
+               }
+           }
+       }
+    }
+

  parent reply	other threads:[~2024-03-08 10:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 13:57 [Bug tree-optimization/114151] New: [14 Regression] weird and inefficient codegen and addressing modes since g:a0b1798042d033fd2cc2c806afbb77875dd2909b tnfchris at gcc dot gnu.org
2024-02-28 14:33 ` [Bug tree-optimization/114151] " rguenth at gcc dot gnu.org
2024-02-28 14:36 ` rguenth at gcc dot gnu.org
2024-02-28 16:51 ` tnfchris at gcc dot gnu.org
2024-02-29  7:19 ` rguenther at suse dot de
2024-02-29 18:15 ` amacleod at redhat dot com
2024-03-01  9:37 ` rguenth at gcc dot gnu.org
2024-03-01 15:02 ` [Bug tree-optimization/114151] [14 Regression] weird and inefficient codegen and addressing modes since r14-9193 amacleod at redhat dot com
2024-03-04  7:47 ` rguenth at gcc dot gnu.org
2024-03-06  3:37 ` amacleod at redhat dot com
2024-03-06  7:14 ` rguenth at gcc dot gnu.org
2024-03-06  7:31 ` rguenth at gcc dot gnu.org
2024-03-06 14:57 ` amacleod at redhat dot com
2024-03-06 20:05 ` amacleod at redhat dot com
2024-03-07  8:04 ` rguenth at gcc dot gnu.org
2024-03-07 15:53 ` amacleod at redhat dot com
2024-03-07 20:37 ` law at gcc dot gnu.org
2024-03-08 10:13 ` rguenth at gcc dot gnu.org [this message]
2024-03-08 10:22 ` tnfchris at gcc dot gnu.org
2024-03-08 14:10 ` rguenth at gcc dot gnu.org
2024-03-12  9:59 ` rguenth at gcc dot gnu.org
2024-03-12 10:00 ` rguenth at gcc dot gnu.org
2024-03-12 20:41 ` amacleod at redhat dot com
2024-03-13  7:38 ` rguenth at gcc dot gnu.org
2024-03-13 17:37 ` amacleod at redhat dot com
2024-03-19 12:12 ` cvs-commit at gcc dot gnu.org
2024-03-19 12:16 ` 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-114151-4-F9bl2o0euB@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).