>
>  I think I need to drop the is_self_write tightening from v2 because it
> caused real regressions in the Linaro precommit testing.
>
> The reported regressions were:
> FAIL: gcc.dg/vect/tsvc/vect-tsvc-s293.c -flto -ffat-lto-objects
> scan-tree-dump vect "vectorized 1 loops"
> FAIL: gcc.dg/vect/tsvc/vect-tsvc-s293.c scan-tree-dump vect "vectorized 1
> loops"
> FAIL: gcc.dg/vect/vect-licm-hoist-1.c -flto -ffat-lto-objects
> scan-tree-dump lim2 "independent \(self write\)"
> FAIL: gcc.dg/vect/vect-licm-hoist-1.c -flto -ffat-lto-objects
> scan-tree-dump vect "loop vectorized"
> FAIL: gcc.dg/vect/vect-licm-hoist-1.c scan-tree-dump lim2 "independent
> \(self write\)"
> FAIL: gcc.dg/vect/vect-licm-hoist-1.c scan-tree-dump vect "loop vectorized"
>
> The reduced pattern is:
> #define N 32000
> float a[N];
> void
> test_safe_hoist (void)
> {
> for (int i = 0; i < N; i++)
> a[i] = a[0];
> }
>
> This is the same self-write pattern as in vect-tsvc-s293.c:
> for (int i = 0; i < LEN_1D; i++)
> a[i] = a[0];
>
> My v2 change made is_self_write require an exact decomposed access and
> max_size == size. That is too strict for this case.
>
> For the load from a[0], ao_ref describes one fixed element:
> base = a
> offset = 0
> size = 32
> max_size = 32
> decomposed = true
>
> For the store to a[i], each dynamic store still writes only one float, so
> size is 32. But because i ranges over the array, ao_ref describes the
> possible
> range of the reference with a larger max_size:
> base = a
> offset = 0
> size = 32
> max_size = 1024000
> decomposed = false
>
> 1024000 is 32000 * 32 bits. It is the possible indexed range of a[i], not
> the
> width of one runtime store.
>
> So requiring max_size == size incorrectly rejects this valid self-write
> case.
> That prevents LIM from hoisting a[0], and then the vectorizer no longer
> sees
> the expected form, which explains both the missing "independent (self
> write)"
> dump and the missed vectorization.
> For that reason I think v3 should keep the series refactoring-only. It
> factors the base/offset comparison used by mem_ref_hasher::equal, but it
> leaves is_self_write unchanged. I think the partial-overlap question should
> be handled separately if we can produce a concrete miscompile or a testcase
> that current code handles incorrectly.
>

Reply via email to