------- Comment #14 from hubicka at gcc dot gnu dot org 2010-09-20 14:26
The fact that C++ vtables are weak or external should no longer bother us with
const_decl_known flag. The problem is that array constructor provided by C++
frontend don't have explicit indexes and thus current folders ignore them.
This is addresses by the long patch of mine using get_ref_base_and_extend I am
just trying to break up ;)
To get folding done I need
1) fixed array folding
2) tree-ssa-ccp patch to get rid of OBJ_TYPE_REF when constant operand is
known and not get bothered by NOP_EXPRs we produce around.
Still we usually need FRE to actually get into at vtable address (it is stored
to memory and then read from it) so we actually fold only after inlining and
then it is all (almost) pointless excercise. So we would also need
3) Do FRE in early passes (that would make sense now when we do have alias
info, I plan to benchmark just moving the pass there) or to teach some other
pass to copy propagate through memory
Still I don't think low level folding should be the mechanizm we rely on when
implementing devirtualization. It is way too low level and requires tracking
of value stored to memory cross call boundaries that is hard.