public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/44462]  New: Redundant looping pure functions whose return value is dead are not optimized out
@ 2010-06-08  7:32 hubicka at gcc dot gnu dot org
  2010-06-08  8:49 ` [Bug tree-optimization/44462] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2010-06-08  7:32 UTC (permalink / raw)
  To: gcc-bugs

For the following testcase:

__attribute__ ((noinline,noclone))
int
i_am_pure (int a)
{
  if (a>10)
    abort();
}

main()
{
  int a = i_am_pure (5) + i_am_pure (5);
  int b = i_am_pure (8) + i_am_pure (8);
  return a;
}

We get only one call to i_am_pure optimized out: 

main ()
{
  int a;
  int D.2721;

<bb 2>:
  D.2721_1 = i_am_pure (5);
  a_3 = D.2721_1 + D.2721_1;
  i_am_pure (8);
  i_am_pure (8);
  return a_3;

}

This is becasue removal is done as part of PRE and we are not removing
function calls without return value.  

Perhaps this can be improved to at least handle FRE quite easilly? In GCC we
now have about 1/4th of pure functions with WHOPR build and some results
especially in autogenerated files are unused and we end up with a lot of
redundant calls there.

Honza


-- 
           Summary: Redundant looping pure functions whose return value is
                    dead are not optimized out
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hubicka at gcc dot gnu dot org
  GCC host triplet: x86_64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44462


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <bug-44462-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-05-10  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-08  7:32 [Bug tree-optimization/44462] New: Redundant looping pure functions whose return value is dead are not optimized out hubicka at gcc dot gnu dot org
2010-06-08  8:49 ` [Bug tree-optimization/44462] " rguenth at gcc dot gnu dot org
2010-06-08 20:10 ` pinskia at gcc dot gnu dot org
2010-06-09  9:11 ` rguenther at suse dot de
2010-06-09 10:30 ` hubicka at ucw dot cz
     [not found] <bug-44462-4@http.gcc.gnu.org/bugzilla/>
2021-05-05 13:49 ` rguenth at gcc dot gnu.org
2021-05-10  9:45 ` rguenth at gcc dot gnu.org

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