https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122582
Thomas Schwinge <tschwinge at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |---
Status|RESOLVED |REOPENED
Ever confirmed|0 |1
CC| |rguenth at gcc dot gnu.org
Last reconfirmed| |2025-11-10
--- Comment #8 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Robin, thanks for caring to understand the issue! Thus reopening.
These two FAIL -> PASS is due to commit
r16-5085-ge51fffdcbb53f10acffd197379585a586720a9b3 "vect: Relax gather/scatter
detection by swapping offset sign".
Before (FAIL) vs. after (PASS), there are no differences in the target
libraries builds, but 'diff'ing '-fdump-tree-all -fdump-tree-vect-details'
before vs. after, the differences are very big. It starts in
'vect-alias-check-10.c.186t.vect':
@@ -806,8 +806,9 @@
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: Analyze phi:
ivtmp_46 = PHI <ivtmp_45(5), 87(2)>
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ===
vect_slp_analyze_operations ===
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ==> examining
statement: _4 = *_3;
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: missed: can't operate on
partial vectors because the target doesn't have an appropriate gather load or
scatter store instruction.
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_load_cost: inside_cost = 16, prologue_cost = 0 .
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: missed: can't operate on
partial vectors because an access isn't contiguous.
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_load_cost: unaligned supported by hardware.
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_load_cost: inside_cost = 17, prologue_cost = 0 .
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ==> examining
statement: _5 = (unsigned char) _4;
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: vect_is_simple_use:
operand *_3, type of def: internal
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: missed: conversion not
supported by target.
@@ -828,12 +829,14 @@
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ===
vectorizable_assignment ===
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ==> examining
statement: *_3 = _7;
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: vect_is_simple_use:
operand (signed char) _6, type of def: internal
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: Vectorizing an
unaligned access.
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_store_cost: inside_cost = 16, prologue_cost = 0 .
-*_3 16 times scalar_load costs 16 in body
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_store_cost: unaligned supported by hardware.
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_model_store_cost: inside_cost = 32, prologue_cost = 0 .
+*_3 1 times vec_construct costs 1 in body
+*_3 16 times unaligned_load (misalign -1) costs 16 in body
_5 + 1 1 times vector_stmt costs 1 in body
<unknown> 1 times vector_load costs 1 in prologue
-_7 16 times scalar_store costs 16 in body
+_7 16 times unaligned_store (misalign -1) costs 16 in body
+_7 16 times vec_to_scalar costs 16 in body
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: operating on full
vectors.
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: epilog loop required
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note:
vect_can_advance_ivs_p:
[Some more similar to that.]
@@ -2275,31 +2287,88 @@
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: { 1, 2, 4, 8 }
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ------>vectorizing
SLP node starting from: _4 = *_3;
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: transform load.
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: create
integer_type-pointer variable to type: signed char vectorizing a pointer ref:
*a_30(D)
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: created a_30(D)
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
vect__4.28_119 = .GATHER_LOAD (vectp_a.26_117, 8B, _116, 1, { 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
-[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _120
= VIEW_CONVERT_EXPR<vector(64) signed char>(vect__4.28_119);
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _118
= MEM <vector(4) signed char> [(sc *)ivtmp_115];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_119 = ivtmp_115 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _120
= MEM <vector(4) signed char> [(sc *)ivtmp_119];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_121 = ivtmp_119 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _122
= MEM <vector(4) signed char> [(sc *)ivtmp_121];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_123 = ivtmp_121 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _124
= MEM <vector(4) signed char> [(sc *)ivtmp_123];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_125 = ivtmp_123 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _126
= MEM <vector(4) signed char> [(sc *)ivtmp_125];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_127 = ivtmp_125 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _128
= MEM <vector(4) signed char> [(sc *)ivtmp_127];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_129 = ivtmp_127 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _130
= MEM <vector(4) signed char> [(sc *)ivtmp_129];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_131 = ivtmp_129 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _132
= MEM <vector(4) signed char> [(sc *)ivtmp_131];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_133 = ivtmp_131 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _134
= MEM <vector(4) signed char> [(sc *)ivtmp_133];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_135 = ivtmp_133 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _136
= MEM <vector(4) signed char> [(sc *)ivtmp_135];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_137 = ivtmp_135 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _138
= MEM <vector(4) signed char> [(sc *)ivtmp_137];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_139 = ivtmp_137 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _140
= MEM <vector(4) signed char> [(sc *)ivtmp_139];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_141 = ivtmp_139 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _142
= MEM <vector(4) signed char> [(sc *)ivtmp_141];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_143 = ivtmp_141 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _144
= MEM <vector(4) signed char> [(sc *)ivtmp_143];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_145 = ivtmp_143 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _146
= MEM <vector(4) signed char> [(sc *)ivtmp_145];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
ivtmp_147 = ivtmp_145 + _117;
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt: _148
= MEM <vector(4) signed char> [(sc *)ivtmp_147];
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: add new stmt:
vect_cst__149 = {_118, _120, _122, _124, _126, _128, _130, _132, _134, _136,
_138, _140, _142, _144, _146, _148};
+[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: created new
init_stmt: vect_cst__149 = {_118, _120, _122, _124, _126, _128, _130, _132,
_134, _136, _138, _140, _142, _144, _146, _148};
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: ------>vectorizing
SLP node starting from: _5 = (unsigned char) _4;
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: vect_is_simple_use:
operand *_3, type of def: internal
[...]/gcc.dg/vect/vect-alias-check-10.c:61:87: note: transform
assignment.
[Etc.]
For the FAILing vs. PASSing 'vect-alias-check-10.s', we've got:
$ git diff --no-index --stat
{a1de16a8e523de2ba928f7b5251059329eef0dc6,e51fffdcbb53f10acffd197379585a586720a9b3}/vect-alias-check-10.s
.../vect-alias-check-10.s | 7896
++++++++++++++++----
1 file changed, 6583 insertions(+), 1313 deletions(-)
That is, the PASSing code is considerably longer. Of course, I don't know if
that's right, for correctness (that is, we really had wrong-code before), or if
that now just hides a problem elsewhere (due to an "wrong optimization" now no
longer happening?), or whatever else -- I'm just the messenger regarding
vectorizer issues, but can't claim to understand that.
The 'diff's for 'vect-alias-check-11.*' are even bigger; I've not looked at
that, just:
$ git diff --no-index --stat
{a1de16a8e523de2ba928f7b5251059329eef0dc6,e51fffdcbb53f10acffd197379585a586720a9b3}/vect-alias-check-11.s
.../vect-alias-check-11.s | 18798
++++++++++++++++---
1 file changed, 16074 insertions(+), 2724 deletions(-)