[patch] Fix type merging deficiency during WPA

Jan Hubicka hubicka@ucw.cz
Mon Jul 11 23:32:00 GMT 2016


> 
> So something akin to what I initially proposed?
>   https://gcc.gnu.org/ml/gcc-patches/2016-07/msg00182.html

I have similar patch to add_expr. I don't think it should have flag_wpa guard:
other FEs are keeping umberged decls, too, just not as often as LTO.

I am not sure about operand_equal_p.  If one decl has warning on it and the
other doesn't we can't unify their uses even if assembler name is the same
because we may end up messing up the warning. I guess we need to wind up more
involved decl comparing here listing properties of decls that needs to match
and it may be bit fun determining which ones we want to support.
(naturally this is also important for ICF that is also currently wrong WRT
warning attributes)

I see that gimple_canonical_types_compatible_p winds up using operand_equal_p
on expressions which represent the array size and that is why you need
walk_simple_constant_arithmetic and operand_equal_p change. This seem conceptually
wrong because operand_equal_p is allowed to have false negatives, but not false
positives. For TBAA purposes we can tolrate false positives, but no false negatives.

I wonder how much code quality we would lose by simply treating only constantly
sized arrays and considering all VLAs of the same type to be compatible?
There are interesting issues WRT C standard and the canonical types of arrays have
just secondary role (i.e. they are hardly used by themselves and only are used
to compute canonical types of structures) and there may be lower hanging fruits
in TBAA improvement than trying to handle sturctures containng VLAs right.

Honza



More information about the Gcc-patches mailing list