https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109747
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- void foo(int *a, int b, int c) { a[0] = b; a[1] = c; a[2] = b; a[3] = c; a[4] = c; a[5] = b; a[6] = c; a[7] = b; } for a simpler testcase. We get node 0x583ae48 1 times vec_construct costs 24 in prologue node 0x583ae48 1 times vec_construct costs 24 in prologue and that loop in x86 add_stmt_cost iterates over the whole CTOR twice rather than just once for each subset (the actual cost is the same here because I repeat b and c only).