On Wed, Oct 12, 2022 at 12:12:38PM -0400, Andrew MacLeod wrote:
> No, I just meant that once we finally process the complicated function, and
> decide the final range we are storing is for x_1 is say [20,30], we could
> replace the assume call site with something like
> 
>   int assume03_x (x) { if (x>= 20 || x <= 30) return x; gcc_unreachable(); }
> 
> then at call sites:
> 
>    x_5 = assume03_x(x_3);
> 
> For that matter, once all the assume functions have been processed, we could
> textually replace the assume call with an expression which represents the
> determined range...  Kind of our own mini inlining?  Maybe thats even better
> than adding any kind of support in fold_using_range..   just let things
> naturally fall into place?
> 
> .ASSUME_blah ( , , x_4);
> 
> where if x is determined to be [20, 30][50,60] could be textually "expanded"
> in the IL with
> 
>   if (x<20 || x>60 || (x>30 && x < 50)) gcc_unreachcable();
> 
> for each of the parameters?   If we processed this like early inlining, we
> could maybe expose the entire thing to optimization that way?

That could work for integral parameters, but doesn't work for floating point
nor when builtins are involved.  We do not want to put floating point
comparisons into the IL as __builtin_unreachable (); guards because they
have observable side-effects (floating point exceptions/traps) and we
wouldn't DCE them for those reasons.  Similarly, if there are builtins
involved we don't want to call the corresponding library functions because
something wasn't DCEd.

        Jakub

Reply via email to