On Mon, 10 Aug 2015, Nathan Sidwell wrote: > Richard. > this is the patch for the min/max optimization I was trying to implement > before getting sidetracked with the phi bug and cleaning the vrp abs > optimization. > > This patch checks both min and max where both operands have a determined > range, and the case where the second op is a constant. When we determine the > operand values are disjoint (modulo a possible single overlapping value) we > replace the min or max with the appropriate operand. > > booted and tested with the other two patches I just posted. > > ok?
The patch looks good. Note that with SSA name operands it can be still profitable to do compare_range_with_value, esp. if the other operand has a symbolical range. See vrp_evaluate_conditional_warnv_with_ops_using_ranges which actually implements a nice helper for evaluating comparisons for code-gen transforms. So I'd prefer that you'd simply call that instead of deciding for yourself on SSA name vs. non-SSA name. Thanks, Richard.