https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121358
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
__attribute__((target ("+sve")))
void foo ()
{
struct A t;
;; basic block 2, loop depth 0
;; pred: ENTRY
MEM <vector(2) int> [(int *)&t] = { 0, POLY_INT_CST [2, 2] };
f (t); [tail call]
expands to
(insn 5 2 6 2 (set (reg/v:DI 101 [ t ])
(subreg:DI (const_vector:V2SI [
(const_int 0 [0])
(const_poly_int:SI [2, 2])
]) 0)) "t.c":9:10 -1
(nil))
BB vect does
t.c:9:10: note: ***** Analysis succeeded with vector mode V16QI
t.c:9:10: note: SLPing BB part
t.c:9:10: note: Costing subgraph:
t.c:9:10: note: node 0x4b755a0 (max_nunits=2, refcnt=1) vector(2) int
t.c:9:10: note: op template: t.b[0] = 0;
t.c:9:10: note: stmt 0 t.b[0] = 0;
t.c:9:10: note: stmt 1 t.b[1] = POLY_INT_CST [2, 2];
t.c:9:10: note: children 0x4b75638
t.c:9:10: note: node (constant) 0x4b75638 (max_nunits=1, refcnt=1) vector(2)
int
t.c:9:10: note: { 0, POLY_INT_CST [2, 2] }
SLP analysis still has
/* Assume we can code-generate all invariants. */
if (!node
|| SLP_TREE_DEF_TYPE (node) == vect_constant_def
|| SLP_TREE_DEF_TYPE (node) == vect_external_def)
return true;
and actual SLP constant generation simply succeeds. We do have
can_duplicate_and_interleave_p checks, but those are for VLA vectors,
this is a constant size one. But we do classify POLY_INT_CST as "constant"
(rather than external, which it probably is - but we'd still simply assume
we can generate it).
Yes, similar to the RISC-V issue. I believe targets should be able to
generate these. If the ABI guarantees a constant factor for the polys
you could even invent a new relocation type for it so these constants
can be emitted into .data!
Now, we can simply reject all constant/external nodes with POLY components.
Is that what we need to do? I'm defering to Richard S.