New patch to address issue brought up in a different thread: mptjzwgplp2....@arm.com
> > + /* Failed to find a widen operation so we check for a regular > > MINUS_EXPR. */ > > + if (diff > > + && gimple_assign_rhs_code (diff) == MINUS_EXPR > > + && (TYPE_UNSIGNED (abs_type) || TYPE_OVERFLOW_UNDEFINED (abs_type))) > > + { > > + *half_type = NULL_TREE; > > + return true; > > + } > > the condition should instead be: > > if (diff > && gimple_assign_rhs_code (diff) == MINUS_EXPR > && TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd))) > { > *half_type = NULL_TREE; > return true; > } > > That is, we rely on overflow being undefined, so we need to check > TYPE_OVERFLOW_UNDEFINED on the type of the subtraction (rather than > abs_type, which is the type of ABS input, and at this point can be > different from TREE_TYPE (abs_oprnd)). I found that doing this alone would get rid of cases which otherwise should have gone through so I added an extra step such that if this part fails we'll try to find the unpromoted diff operands and then try the type overflow check on the types of the unpromoted operands. Patch is in the next response.