[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread pinskia at gcc dot gnu.org


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



Andrew Pinski  changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

  Component|c   |tree-optimization

 Resolution||INVALID



--- Comment #1 from Andrew Pinski  2013-01-24 
18:45:19 UTC ---

You want:

__attribute__((noinline, noclone))

static int func_ni() {

  asm("");

  return 1;

}



 CUT 

So the function is not considered pure/const and does not get cloned either.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread yuri at tsoft dot com


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



--- Comment #2 from Yuri  2013-01-24 19:06:12 UTC ---

Created attachment 29267

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29267

asm of the testcase showing there is still no noinline function



I am trying 'noclone' with gcc-4.7.1 but there is still no func_ni in the

resulting output:

/opt/gcc/4.7.1/bin/gcc -O2 -S ni.c

See ni.s attached


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread pinskia at gcc dot gnu.org


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



--- Comment #3 from Andrew Pinski  2013-01-24 
19:11:33 UTC ---

(In reply to comment #2)

> Created attachment 29267 [details]

> asm of the testcase showing there is still no noinline function



You need the inline-asm also to force the const/pure detection from happening.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread yuri at tsoft dot com


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



--- Comment #4 from Yuri  2013-01-24 19:16:10 UTC ---

You are saying I also need to place some __asm__ into this noinline function?

Doesn't this look like working around some bugs in gcc? User doesn't need to

know how gcc is doing this inside, weather it is cloning something or treats it

as pure or not. noinline means do-not-inline, no matter what is inside.



I originally asked for a simple basic thing, and so many gcc guts got exposed

by this.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread pinskia at gcc dot gnu.org


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



--- Comment #5 from Andrew Pinski  2013-01-24 
19:22:43 UTC ---

(In reply to comment #4)

> You are saying I also need to place some __asm__ into this noinline function?

> Doesn't this look like working around some bugs in gcc? User doesn't need to

> know how gcc is doing this inside, weather it is cloning something or treats 
> it

> as pure or not. noinline means do-not-inline, no matter what is inside.





No it is not working around a bug in GCC.  You wrote the function with no side

effects so GCC decided to remove the call to the function as it has no side

effects.  The inline-asm causes GCC to see there are side effects in the

function which are unknown to GCC and does nothing to it.



> 

> I originally asked for a simple basic thing, and so many gcc guts got exposed

> by this.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread yuri at tsoft dot com


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



--- Comment #6 from Yuri  2013-01-24 19:24:43 UTC ---

I think 'noinline' flag should be factored into the removal decision.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2013-01-24 Thread pinskia at gcc dot gnu.org


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



--- Comment #7 from Andrew Pinski  2013-01-24 
19:28:59 UTC ---

(In reply to comment #6)

> I think 'noinline' flag should be factored into the removal decision.



No because this is not about inlining.  This is about side effects on the

function and there is none.


[Bug tree-optimization/56099] Empty static noinline functions aren't called from optimized code

2023-01-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56099

Andrew Pinski  changed:

   What|Removed |Added

 Resolution|INVALID |DUPLICATE

--- Comment #8 from Andrew Pinski  ---
Dup of bug 16922.

*** This bug has been marked as a duplicate of bug 16922 ***