public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Irreducible loops in generated code
@ 2010-08-18 13:06 Alain Ketterlin
  2010-08-18 13:11 ` Steven Bosscher
  0 siblings, 1 reply; 4+ messages in thread
From: Alain Ketterlin @ 2010-08-18 13:06 UTC (permalink / raw)
  To: gcc


I'm working on decompiling x86-64 binary programs, using branches to 
rebuild a control-flow graph and looking for loops. I've found a 
significant number of irreducible loops in gcc-produced code 
(irreducible loops are loops with more than one entry point), especially 
in -O3 optimized binaries, even when the source code is "well" 
structured. My experiments are done mainly on the SPEC CPU-2006 benchmarks.

My question is: where do these irreducible loops come from? Which 
optimization pass leads to irreducible regions? Thanks in advance for 
any pointer.

-- Alain.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Irreducible loops in generated code
  2010-08-18 13:06 Irreducible loops in generated code Alain Ketterlin
@ 2010-08-18 13:11 ` Steven Bosscher
  2010-08-18 16:51   ` Alain Ketterlin
  2010-08-20  0:11   ` Zdenek Dvorak
  0 siblings, 2 replies; 4+ messages in thread
From: Steven Bosscher @ 2010-08-18 13:11 UTC (permalink / raw)
  To: Alain Ketterlin; +Cc: gcc

On Wed, Aug 18, 2010 at 11:53 AM, Alain Ketterlin
<alain.ketterlin@gmail.com> wrote:
>
> I'm working on decompiling x86-64 binary programs, using branches to rebuild
> a control-flow graph and looking for loops. I've found a significant number
> of irreducible loops in gcc-produced code (irreducible loops are loops with
> more than one entry point), especially in -O3 optimized binaries, even when
> the source code is "well" structured. My experiments are done mainly on the
> SPEC CPU-2006 benchmarks.
>
> My question is: where do these irreducible loops come from? Which
> optimization pass leads to irreducible regions? Thanks in advance for any
> pointer.

Questions right back at you: What compiler version are you using? Got
a specific exampe (test case)?

In older releases of GCC4, jump threading sometimes resulted in
irreducible regions, but more recent GCCs carefully try to avoid them.

Ciao!
Steven

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Irreducible loops in generated code
  2010-08-18 13:11 ` Steven Bosscher
@ 2010-08-18 16:51   ` Alain Ketterlin
  2010-08-20  0:11   ` Zdenek Dvorak
  1 sibling, 0 replies; 4+ messages in thread
From: Alain Ketterlin @ 2010-08-18 16:51 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc

On 18/08/2010 12:37, Steven Bosscher wrote:
> On Wed, Aug 18, 2010 at 11:53 AM, Alain Ketterlin
> <alain.ketterlin@gmail.com>  wrote:

>> My question is: where do these irreducible loops come from? Which
>> optimization pass leads to irreducible regions? Thanks in advance for any
>> pointer.

> Questions right back at you: What compiler version are you using? Got
> a specific exampe (test case)?

Sure, sorry, forgot that: it's gcc 4.4.3 (the one that comes with Ubuntu 
Lucid). My test cases are SPEC programs. I haven't been able to extract 
a simple example, it usually happens on large functions with heavily 
nested loops.

> In older releases of GCC4, jump threading sometimes resulted in
> irreducible regions, but more recent GCCs carefully try to avoid them.

Excellent news :-) OK, I'll try the new version and report back what I 
find. Thanks for the help.

-- Alain.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Irreducible loops in generated code
  2010-08-18 13:11 ` Steven Bosscher
  2010-08-18 16:51   ` Alain Ketterlin
@ 2010-08-20  0:11   ` Zdenek Dvorak
  1 sibling, 0 replies; 4+ messages in thread
From: Zdenek Dvorak @ 2010-08-20  0:11 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: Alain Ketterlin, gcc

Hi,

> > I'm working on decompiling x86-64 binary programs, using branches to rebuild
> > a control-flow graph and looking for loops. I've found a significant number
> > of irreducible loops in gcc-produced code (irreducible loops are loops with
> > more than one entry point), especially in -O3 optimized binaries, even when
> > the source code is "well" structured. My experiments are done mainly on the
> > SPEC CPU-2006 benchmarks.
> >
> > My question is: where do these irreducible loops come from? Which
> > optimization pass leads to irreducible regions? Thanks in advance for any
> > pointer.
> 
> Questions right back at you: What compiler version are you using? Got
> a specific exampe (test case)?
> 
> In older releases of GCC4, jump threading sometimes resulted in
> irreducible regions, but more recent GCCs carefully try to avoid them.

I am not sure that is actually true.  Afaik, we only avoid this on gimple,
while rtl jump threading does not care,

Zdenek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-19 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-18 13:06 Irreducible loops in generated code Alain Ketterlin
2010-08-18 13:11 ` Steven Bosscher
2010-08-18 16:51   ` Alain Ketterlin
2010-08-20  0:11   ` Zdenek Dvorak

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).