public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations @ 2005-08-16 1:00 tkho at ucla dot edu 2005-08-16 1:05 ` [Bug tree-optimization/23414] " tkho at ucla dot edu ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: tkho at ucla dot edu @ 2005-08-16 1:00 UTC (permalink / raw) To: gcc-bugs I built the attached test case with -O2 -save-temps -funsafe-loop-optimizations. The entire call to a() should be optimized away if the loop optimization works right, but it's not. The assembly shows these three useless instructions left in a(): a: pushl %ebp movl %esp, %ebp popl %ebp ret -- Summary: function call not optimized away after unsafe-loop- optimizations Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tkho at ucla dot edu CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: i686-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23414] function call not optimized away after unsafe-loop-optimizations 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu @ 2005-08-16 1:05 ` tkho at ucla dot edu 2005-08-16 1:05 ` pinskia at gcc dot gnu dot org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: tkho at ucla dot edu @ 2005-08-16 1:05 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From tkho at ucla dot edu 2005-08-16 00:59 ------- Created an attachment (id=9501) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9501&action=view) testcase gcc -O2 -save-temps -funsafe-loop-optimizations loop.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23414] function call not optimized away after unsafe-loop-optimizations 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu 2005-08-16 1:05 ` [Bug tree-optimization/23414] " tkho at ucla dot edu @ 2005-08-16 1:05 ` pinskia at gcc dot gnu dot org 2005-08-16 1:23 ` tkho at ucla dot edu ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-16 1:05 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 01:05 ------- The three instructions are the setup of the frame pointer. This is a dup of bug 13822. Either use -fomit-frame-pointer or convince someone to turn on -fomit- frame-pointer for x86 by default. *** This bug has been marked as a duplicate of 13822 *** -- What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23414] function call not optimized away after unsafe-loop-optimizations 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu 2005-08-16 1:05 ` [Bug tree-optimization/23414] " tkho at ucla dot edu 2005-08-16 1:05 ` pinskia at gcc dot gnu dot org @ 2005-08-16 1:23 ` tkho at ucla dot edu 2005-08-16 1:26 ` [Bug tree-optimization/23414] pure function is not dectected for functions with non infinite loops pinskia at gcc dot gnu dot org 2005-08-16 2:21 ` [Bug tree-optimization/23414] const " pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: tkho at ucla dot edu @ 2005-08-16 1:23 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From tkho at ucla dot edu 2005-08-16 01:11 ------- Why is it that the call to b() is completely optimized away while the call to a() still exists? -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|DUPLICATE | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23414] pure function is not dectected for functions with non infinite loops 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu ` (2 preceding siblings ...) 2005-08-16 1:23 ` tkho at ucla dot edu @ 2005-08-16 1:26 ` pinskia at gcc dot gnu dot org 2005-08-16 2:21 ` [Bug tree-optimization/23414] const " pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-16 1:26 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 01:23 ------- The issue here is more complex. We are not dected the function with the loop as constant so we don't mark it as the function a as not having side effects. The most ovbvious way to fix this would do the ipa optimizations on the ssa level where we can get the loop information and check to see if the loops are finite. A simple example is even without -funsafe-loop-optimization: void a(int start, int finish) { for (; start < finish; ++start) { } } int main() { int x = 0, y = 99; a(x, y); } -- What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |missed-optimization Last reconfirmed|0000-00-00 00:00:00 |2005-08-16 01:23:37 date| | Summary|function call not optimized |pure function is not |away after unsafe-loop- |dectected for functions with |optimizations |non infinite loops http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/23414] const function is not dectected for functions with non infinite loops 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu ` (3 preceding siblings ...) 2005-08-16 1:26 ` [Bug tree-optimization/23414] pure function is not dectected for functions with non infinite loops pinskia at gcc dot gnu dot org @ 2005-08-16 2:21 ` pinskia at gcc dot gnu dot org 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu dot org @ 2005-08-16 2:21 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-16 01:25 ------- (In reply to comment #4) > The most ovbvious way to fix this would do the ipa optimizations on the ssa level where we can get > the loop information and check to see if the loops are finite. I should mention that will not happen until at least 4.2.0. -- What |Removed |Added ---------------------------------------------------------------------------- Summary|pure function is not |const function is not |dectected for functions with|dectected for functions with |non infinite loops |non infinite loops http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23414 ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-08-16 1:26 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-08-16 1:00 [Bug tree-optimization/23414] New: function call not optimized away after unsafe-loop-optimizations tkho at ucla dot edu 2005-08-16 1:05 ` [Bug tree-optimization/23414] " tkho at ucla dot edu 2005-08-16 1:05 ` pinskia at gcc dot gnu dot org 2005-08-16 1:23 ` tkho at ucla dot edu 2005-08-16 1:26 ` [Bug tree-optimization/23414] pure function is not dectected for functions with non infinite loops pinskia at gcc dot gnu dot org 2005-08-16 2:21 ` [Bug tree-optimization/23414] const " pinskia at gcc dot gnu dot 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).