> Hum, the fact that your earlier version created wrong code > (get_gimple_for_ssa_name > already returned false here) points at some issues with > EXPAND_INITIALIZER as well, no...?
Theoritically yes but, in practice, EXPAND_INITIALIZER is used in varasm.c and for debugging stuff only, so I don't think that's a real concern. > That said, the path you add is certainly safe (though maybe we want to > change get_gimple_for_ssa_name to return tcc_constant single-use defs even > if TER is disabled > (thus at -O0 - and only at -O0, otherwise it shouldn't happen). That > would cover > more cases of get_gimple_for_ssa_name uses (I can see > optimize_bitfield_expansion > for example...) optimize_bitfield_assignment_op is only interested in loads from bitfields though. The get_gimple_for_ssa_name route would be interesting to bypass the stmt_is_replaceable_p test, i.e. to bypass the single-use test, but this could be counter-productive at -O0 so I'm not sure it's worth the trouble. -- Eric Botcazou