On Fri, Apr 10, 2009 at 12:03 AM, Eric Botcazou <ebotca...@adacore.com> wrote: > Hi, > > we're almost ready to get rid of the awkward semantics that is implemented in > the middle-end and the optimizers for subtypes (INTEGER_TYPEs with a non-null > TREE_TYPE); this should overall simplify things, make the support for invalid > values in Ada more robust and expose more optimization opportunities. > > Patches have already been written and tested (I've attached the non-gigi part > we currently use, preparatory patches are required for gigi first). All the > subtypes are given maximal bounds for their precision, except for TYPE_DOMAIN > of array types like in C, and thus become first class citizens. This makes > it possible to eliminate code in gigi, the gimplifier, the loop optimizer, > the VRP pass, etc. needed to specifically support their special semantics. > > This in turn means that the gimplification will eliminate most of the casts > between subtypes and base types, making the optimizers more effective. The > exception will be the VRP pass, most notably when checks are off in Ada, so > we'll need to be able to drive VRP differently from gigi.
I wonder what this exception in VRP looks like? I also wonder if adding a test to the gimplifier that all integral typed DECL types have NULL TREE_TYPE and TYPE_MIN/MAX_VALUE according to their TYPE_PRECISION would pass with your changes (there may be such odd cases with other frontends ...). Thanks for this work - in general I support this (well, you know that ;)). Richard. > > Comments/suggestions welcome. > > > * fold-const.c (fold_truth_not_expr) <CONVERT_EXPR>: Do not strip > it if the destination type is boolean. > * tree-chrec.c (avoid_arithmetics_in_type_p): Delete. > (convert_affine_scev): Remove call to above function. > (chrec_convert_aggressive): Likewise. > * tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: > Propagate the type of the first operand. > (follow_ssa_edge_in_rhs) <GIMPLE_BINARY_RHS>: Likewise > * tree-ssa.c (useless_type_conversion_p_1): Do not specifically return > false for conversions involving subtypes. > * tree-vrp.c (vrp_val_max): Do not get to the base type. > (vrp_val_min): Likewise. > (needs_overflow_infinity): Do not special-case subtypes. > (extract_range_from_unary_expr): Do not use the base types. > > > -- > Eric Botcazou >