This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/19431] missed optimization with ifs and deferencing
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2007 19:00:08 -0000
- Subject: [Bug tree-optimization/19431] missed optimization with ifs and deferencing
- References: <bug-19431-6528@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from pluto at agmk dot net 2007-02-25 19:00 -------
one more testcase:
#include <tr1/functional>
#include <algorithm>
extern void assign( long* variable, long v )
{
std::transform( variable, variable + 1, variable,
std::tr1::bind( std::plus< long >(), 0L, v ) );
}
extern void assign( long& variable, long v )
{
std::transform( &variable, &variable + 1, &variable,
std::tr1::bind( std::plus< long >(), 0L, v ) );
}
at -O3 gcc 4.2 produces:
assign(long&, long):
movq -40(%rsp), %rax
movq %rsi, -24(%rsp)
movq $0, -32(%rsp)
movq $0, -64(%rsp)
movq %rsi, -56(%rsp)
movq %rsi, (%rdi)
movq %rax, -72(%rsp)
ret
assign(long*, long):
movq %rsi, (%rdi)
ret
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19431