* [COMMITTED] Fix ifcvt-4.c to not depend on VRP2 asserts.
@ 2021-10-28 14:51 Andrew MacLeod
0 siblings, 0 replies; only message in thread
From: Andrew MacLeod @ 2021-10-28 14:51 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
as discussed elsewhere, gcc.dg/ifcvt-4.c seems to be a flawed testcase
as it is.
it does not use __builtin_expect properly, so edges are predicted
50/50. It also turns out that it only works due to an oddity that
causes the basic blocks to be restructured by the VRP2 pass when it
removes all the ASSERT_EXPRs that it uses. If we run ranger for VRP2,
the testcase fails because the blocks do not get rearranged.
This patch tweaks the testcase so that it uses expect properly and
passes with both classic vrp2, and ranger vrp2. I have tested it on
both powerpc and x86 which seem the be the primaries. Pushed.
Andrew
[-- Attachment #2: 0003-Fix-ifcvt-4.c-to-not-depend-on-VRP2-asserts.patch --]
[-- Type: text/x-patch, Size: 984 bytes --]
From d123daec0c237533cf974334d98bc6d357d4273e Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Mon, 25 Oct 2021 13:34:36 -0400
Subject: [PATCH 3/3] Fix ifcvt-4.c to not depend on VRP2 asserts.
The testcase fails if VRP2 is replaced with a non-assert based VRP because it
accidentally depends on specific IL changes when the asserts are removed. This
removes that dependency.
gcc/testsuite/
* gcc.dg/ifcvt-4.c: Adjust.
---
gcc/testsuite/gcc.dg/ifcvt-4.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/testsuite/gcc.dg/ifcvt-4.c b/gcc/testsuite/gcc.dg/ifcvt-4.c
index ec142cfd943..e74e449b402 100644
--- a/gcc/testsuite/gcc.dg/ifcvt-4.c
+++ b/gcc/testsuite/gcc.dg/ifcvt-4.c
@@ -13,8 +13,7 @@ foo (word x, word y, word a)
word i = x;
word j = y;
/* Try to make taking the branch likely. */
- __builtin_expect (x > y, 1);
- if (x > y)
+ if (__builtin_expect (x > y, 0))
{
i = a;
j = i;
--
2.17.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-28 14:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 14:51 [COMMITTED] Fix ifcvt-4.c to not depend on VRP2 asserts Andrew MacLeod
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).