This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Small object optimizations
- From: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 10 Oct 2002 11:15:47 +0200 (CEST)
- Subject: Small object optimizations
Hi!
For decent C++ performance wrt abstraction of small objects g++ lacks
optimization regarding to optimizing away memory bindings to such objects
like in:
struct simple {
simple& operator+(int k) { i+=k; j+=k; return *this; }
int i, j
};
int foo() {
simple s;
s = s + 1;
return s.i;
}
would it be possible to improve the optimization of such small objects
(maybe restrict to PODs)
having a optimization pass that, after inlining, for each objects lifetime
(maybe just in one basic block, if this is the lifetime of the
object - should work well for temporaries) search
for operations on the whole object (i.e. not inlined uses) and if none
found tear apart the
object and let later passes optimize away unused variables?
I.e. for the example above after inlining the operator+ drop all
references to type simple and just keep two ints?
No, I'm not volunteering due to lack of time and gcc internals
knowledge.
Richard.
--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/