On Thu, Apr 10, 2025 at 10:32:57AM +0100, Richard Sandiford wrote:
> In r10-4803-g8489e1f45b50600c I'd used POINTER_DIFF_EXPR to subtract
> the two pointers involved in an overlap test.  I'm not sure whether
> I'd specifically chosen that over MINUS_EXPR or not; if so, the only
> reason I can think of is that it is probably faster on targets with
> PSImode pointers.  Regardless, as the PR points out, subtracting
> unrelated pointers using POINTER_DIFF_EXPR is undefined behaviour.
> 
> Tested on aarch64-linux-gnu & x86_64-linux-gnu.  OK for trunk, and
> for backports after a grace period?
> 
> Richard
> 
> 
> gcc/
>       PR tree-optimization/119399
>       * tree-data-ref.cc (create_waw_or_war_checks): Use a MINUS_EXPR
>       on two converted pointers, rather than converting a POINTER_DIFF_EXPR
>       on the pointers.
> 
> gcc/testsuite/
>       PR tree-optimization/119399
>       * gcc.dg/vect/pr119399.c: New test.

LGTM.

        Jakub

Reply via email to