This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36965] New: Unnecessary unrolling+regular call instead of tail call
- From: "sam at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2008 15:01:15 -0000
- Subject: [Bug c++/36965] New: Unnecessary unrolling+regular call instead of tail call
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code, compiled with "g++ -O2", unrolls a number of the recursive
calls of "is_frozen", then ends up with a "call" followed by a "leave" (non
tail-call). It could use tail-recursion instead, which would be more space and
cache efficient.
Using g++ (GCC) 4.4.0 20080727 (experimental).
struct Tag {
bool is_frozen() const
{
return frozen || (parent && parent->is_frozen());
};
Tag* parent;
bool frozen;
};
bool f(Tag& t)
{
return t.is_frozen();
}
--
Summary: Unnecessary unrolling+regular call instead of tail call
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sam at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36965