public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Christophe Lyon <christophe.lyon@linaro.org>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: Statically propagate basic blocks which are likely executed 0 times
Date: Fri, 09 Jun 2017 09:54:00 -0000	[thread overview]
Message-ID: <20170609095435.GD6887@kam.mff.cuni.cz> (raw)
In-Reply-To: <CAKdteOboVwYtqCgofsZR85eG17kOeusa+iVzKcg_0TU-piNHjg@mail.gmail.com>

> Since this commit (r249013), I've noticed a regression on arm targets:
> FAIL: gcc.target/arm/cold-lc.c scan-assembler-not bl[^\n]*dump_stack

I think that is because we optimize the testcase:
/* { dg-do compile } */
/* { dg-options "-O2 -mlong-calls" } */
/* { dg-final { scan-assembler-not "bl\[^\n\]*dump_stack" } } */

extern void dump_stack (void) __attribute__ ((__cold__)) __attribute__ ((noinline));
struct thread_info {
    struct task_struct *task;
};
extern struct thread_info *current_thread_info (void);
extern int show_stack (struct task_struct *, unsigned long *);

void dump_stack (void)
{
    unsigned long stack;
    show_stack ((current_thread_info ()->task), &stack);
}

void die (char *str, void *fp, int nr)
{
    dump_stack ();
    while (1);
}

the new logic will move die() into cold section (because it unavoidably leads to cold
code and thus allow using the bl instruction.
I guess just modifying die to call dump_stack conditionally should fix the testcase.

Honza
> 
> 
> >>+  if (!n->analyzed
> >>+      || n->decl == current_function_decl)
> >>+    return false;
> >>+  return n->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED;
> >>+}
> >

  reply	other threads:[~2017-06-09  9:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 12:52 Jan Hubicka
2017-06-09  6:43 ` Bernhard Reutner-Fischer
2017-06-09  9:04   ` Christophe Lyon
2017-06-09  9:54     ` Jan Hubicka [this message]
2017-06-12 10:19       ` Renlin Li
2017-06-12 10:36         ` Jan Hubicka
2017-06-09 18:35   ` Jan Hubicka

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=20170609095435.GD6887@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=christophe.lyon@linaro.org \
    --cc=gcc-patches@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).