This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Serious performance regression -- some tree optimizerquestions


> Thank you for looking into this!  Unfortunately the patch isn't quite
> sufficient yet -- while it does recognize that the 'basic' induction
> variables like i1 cannot overflow, it doesn't recognize that 'derived'
> variables like (i1 + 1) cannot overflow either.
> 
> The reason appears to be that the CHREC_NO_OVERFLOW flag is not
> propagated through various folding operations on chrecs, like
> chrec_fold_plus, chrec_fold_minus, and even chrec_convert itself.
> 
> It would appear to be correct to set the CHREC_NO_OVERFLOW flag
> on the result of chrec_fold_plus, say, if the inputs are either
> invariant or themselves cannot overflow, and the current data type
> is also such that the operation to be folded cannot overflow.
> ...

I apologize if this comment is misplaced, but it seems that one of the
things that tree optimization seems not to be doing (which seems important,
and would seem to simplify the determination of expressions sensitivity to
overflow, etc.) is to identify the maximum precision actually required of
any operation/operand evaluation based on it's assigned destination's actual
precision requirement (as although expressions may overflow it's use may be
insensitive to it).

As it seems for example, given:

  (size-x)X = (size-y)Y (size-binop)BINOP (size-z)Z;

- (size-binop) need never be wider than the smaller of either: it's
  destination (size-x) requirement, or maximum result size of the binop
  with (size-y) and (size-z) operands.

- and corespondingly (size-y)X and (size-z)Y need never be literally
  promoted unless the target-machine's (size-binop) operation requires it,
  but may be logically demoted if exceeding the precision requirements of
  the operation as determined by it's destination precision requirements

In other words, determine precision / overflow sensitivities from the top
(the last assigned use) of the expression tree down, not the bottom up
without knowledge of the expressions true need? (where the same basic rules
may be applied during the initial construction of the tree as well).



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]