From: Andrew MacLeod <amacleod@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "hernandez, aldy" <aldyh@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
Jakub Jelinek <jakub@redhat.com>,
Jeff Law <jeffreyalaw@gmail.com>
Subject: [COMMITTED] Make ranger the vrp1 default.
Date: Tue, 1 Nov 2022 09:58:00 -0400 [thread overview]
Message-ID: <100da11f-424c-71e0-1275-f161b94ffa46@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1760 bytes --]
This patch turns ranger on by default for the VRP1 pass.
I needed to adjust gcc.dg/pr68217.c to scan for a better range ([-INF,
-INF][0, 0]) than the original [-INF, 0] it was looking for.
This also triggers the new __builtin_unreachable code in the ranger VRP
pass, so I added a new testcase to show accumulated unreachables are
combined properly. tree-ssa/pr107009.c also verifies that a
non-dominated unreachable call doesn't incorrectly affect the global range.
Bootstrapped on x86_64-pc-linux-gnu with no regressions*. Pushed.
* OK. no regressions is debatable. I've been seeing the following
spurious failure for the past few weeks. Ranger made them pass for a
while, then made them fail, so Ive been ignoring them. I took a quick
look. Basically, we optimize away an unnecessary statement feeding a
condition based on a combination of what ranger calculates and results
from loop analysis. (The statement is not referenced in any debug
statement). That later causes a PHI to no longer been needed, and DCE2
removed the PHI and some other stuff, which then causes the debug_stmt
to lose its reference. /blame dce2 :-)
< FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 21 x == 10 - i
< FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i
< FAIL: gcc.dg/guality/pr54693-2.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 21 z == 30 - 3 * i
I choose to ignore this for now... I want to get VRP1 turned to ranger
by default and see if any issues show up. I believe this removes the
last remaining use of legacy vrp.
Andrew
[-- Attachment #2: 0004 --]
[-- Type: text/plain, Size: 2787 bytes --]
commit e7310e24b1c0ca67b1bb507c1330b2bf39e59e32
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Tue Oct 25 16:42:41 2022 -0400
Make ranger vrp1 default.
Turn on ranger as the default vrp1 pass and adjust testcases.
gcc/
* params.opt (param_vrp1_mode): Make ranger default.
gcc/testsuite/
* gcc.dg/pr68217.c: Test [-INF, -INF][0, 0] instead of [-INF, 0].
* gcc.dg/tree-ssa/vrp-unreachable.c: New. Test unreachable removal.
diff --git a/gcc/params.opt b/gcc/params.opt
index 3001566e641..a34fee193fc 100644
--- a/gcc/params.opt
+++ b/gcc/params.opt
@@ -1166,7 +1166,7 @@ Common Joined UInteger Var(param_vect_induction_float) Init(1) IntegerRage(0, 1)
Enable loop vectorization of floating point inductions.
-param=vrp1-mode=
-Common Joined Var(param_vrp1_mode) Enum(vrp_mode) Init(VRP_MODE_VRP) Param Optimization
+Common Joined Var(param_vrp1_mode) Enum(vrp_mode) Init(VRP_MODE_RANGER) Param Optimization
--param=vrp1-mode=[vrp|ranger] Specifies the mode VRP1 should operate in.
-param=vrp2-mode=
diff --git a/gcc/testsuite/gcc.dg/pr68217.c b/gcc/testsuite/gcc.dg/pr68217.c
index eb4f15e048f..60c80106760 100644
--- a/gcc/testsuite/gcc.dg/pr68217.c
+++ b/gcc/testsuite/gcc.dg/pr68217.c
@@ -10,4 +10,4 @@ int foo (void)
return 0;
}
-/* { dg-final { scan-tree-dump "\\\[-INF, 0\\\]" "vrp1" } } */
+/* { dg-final { scan-tree-dump "\\\[-INF, -INF\\\]\\\[0, 0\\\]" "vrp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c
new file mode 100644
index 00000000000..cdc57403c6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp-unreachable.c
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1-alias -fdump-tree-vrp2-alias" } */
+
+void dead (unsigned n);
+void alive (unsigned n);
+
+void func (unsigned n, unsigned m)
+{
+ if (n == 0)
+ __builtin_unreachable();
+ if (n == 1)
+ __builtin_unreachable();
+ if (n & 0x1)
+ __builtin_unreachable();
+ if (n == 2)
+ __builtin_unreachable();
+ if (n == 3)
+ __builtin_unreachable();
+ if (n & 0x2)
+ __builtin_unreachable();
+ if (n == 4)
+ __builtin_unreachable();
+ if (n == 5)
+ __builtin_unreachable();
+ if (n & 0x4)
+ __builtin_unreachable();
+ if (n == 6)
+ __builtin_unreachable();
+ if (n == 7)
+ __builtin_unreachable();
+ if (n <8)
+ dead (n);
+ if (n != m)
+ __builtin_unreachable();
+ alive (n);
+ alive (m);
+}
+
+/* { dg-final { scan-tree-dump-not "dead" "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "builtin_unreachable" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-not "builtin_unreachable" "vrp2" } } */
+/* { dg-final { scan-tree-dump-times "fff8" 4 "vrp2" } } */
reply other threads:[~2022-11-01 13:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=100da11f-424c-71e0-1275-f161b94ffa46@redhat.com \
--to=amacleod@redhat.com \
--cc=aldyh@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jeffreyalaw@gmail.com \
--cc=richard.guenther@gmail.com \
/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).