public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: "Martin Liška" <mliska@suse.cz>,
	"Richard Biener" <richard.guenther@gmail.com>,
	"Jeff Law" <law@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Jan Hubicka <hubicka@ucw.cz>
Subject: Re: [PATCH] Dump probability for edges a frequency for BBs
Date: Wed, 30 Nov 2016 22:46:00 -0000	[thread overview]
Message-ID: <61b0cba1-ce4d-2bad-165c-9cc7e13124a4@gmail.com> (raw)
In-Reply-To: <1c516d8f-8ff5-4cf8-cbd6-9f503b5c1695@suse.cz>

On 11/24/2016 05:59 AM, Martin Liška wrote:
> On 11/24/2016 09:29 AM, Richard Biener wrote:
>> Please guard with ! TDF_GIMPLE, otherwise the output will not be parseable
>> with the GIMPLE FE.
>>
>> RIchard.
>
> Done and verified that and it provides equal dumps for -fdump*-gimple.
> Installed as r242837.

Hi Martin,

I'm trying to understand how to interpret the probabilities (to
make sure one of my tests, builtin-sprintf-2.c, is testing what
it's supposed to be testing).

With this example:

   char d2[2];

   void f (void)
   {
     if (2 != __builtin_sprintf (d2, "%i", 12))
       __builtin_abort ();
   }

the probability of the branch to abort is 0%:

   f1 ()
   {
     int _1;

     <bb 2> [100.0%]:
     _1 = __builtin_sprintf (&d, "%i", 12);
     if (_1 != 2)
       goto <bb 3>; [0.0%]
     else
       goto <bb 4>; [100.0%]

     <bb 3> [0.0%]:
     __builtin_abort ();

     <bb 4> [100.0%]:
     return;
   }

Yet the call to abort is in the assembly so I would expect its
probability to be more than zero.  So my question is: it it safe
to be testing for calls to abort in the optimized dump as a way
of verifying that the call has not been eliminated from the program
regardless of their probabilities?

For reference, the directive the test uses since this change was
committed looks like this:

{ dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n 
*__builtin_abort" 114 "optimized" }

If I'm reading the heavily escaped regex right it matches any
percentage, even 0.0% (and the test passes).

Thanks
Martin

  reply	other threads:[~2016-11-30 22:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 14:00 Martin Liška
2016-11-23 21:36 ` Jeff Law
2016-11-24  8:30   ` Richard Biener
2016-11-24  9:50     ` Jan Hubicka
2016-11-24 11:08       ` Richard Biener
2016-11-24 12:59     ` Martin Liška
2016-11-30 22:46       ` Martin Sebor [this message]
2016-12-01  9:49         ` Martin Liška
2016-12-01 16:40           ` Martin Sebor
2016-12-01 16:49             ` Martin Sebor
2016-12-01 17:38               ` Jeff Law
2016-12-01 21:17               ` Martin Liška

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=61b0cba1-ce4d-2bad-165c-9cc7e13124a4@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=law@redhat.com \
    --cc=mliska@suse.cz \
    --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).