https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126053
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Target| |x86_64-*-*
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
On trunk I'm seeing
t.c:50:16: note: ==> examining statement: *f_j_62.x = _30;
t.c:50:16: note: vect_is_simple_use: operand _29 - tmp_x_68, type of def:
internal
t.c:50:16: note: Vectorizing an unaligned access.
t.c:50:16: note: vect_model_store_cost: unaligned supported by hardware.
t.c:50:16: note: vect_model_store_cost: inside_cost = 16, prologue_cost = 0 .
t.c:50:16: missed: Cannot determine insertion place for lane extract
...
t.c:50:16: note: Costing subgraph:
t.c:50:16: note: node 0x1e7fc5a0 (max_nunits=2, refcnt=1) vector(2) double
t.c:50:16: note: op template: *f_j_62.x = _30;
t.c:50:16: note: stmt 0 *f_j_62.x = _30;
t.c:50:16: note: stmt 1 *f_j_62.y = _40;
t.c:50:16: note: children 0x1e7fc650
t.c:50:16: note: node 0x1e7fc650 (max_nunits=2, refcnt=1) vector(2) double
t.c:50:16: note: op template: _30 = _29 - tmp_x_68;
t.c:50:16: note: stmt 0 _30 = _29 - tmp_x_68;
t.c:50:16: note: stmt 1 _40 = _39 - tmp_y_78;
t.c:50:16: note: children 0x1e7fc2e0 0x1e7fc910
t.c:50:16: note: node 0x1e7fc2e0 (max_nunits=2, refcnt=1) vector(2) double
t.c:50:16: note: op template: _29 = *f_j_62.x;
t.c:50:16: note: stmt 0 _29 = *f_j_62.x;
t.c:50:16: note: stmt 1 _39 = *f_j_62.y;
t.c:50:16: note: node 0x1e7fc910 (max_nunits=2, refcnt=1) vector(2) double
t.c:50:16: note: op template: tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: stmt 0 tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: [l*]stmt 1 tmp_y_78 = p_ij_y_64 * force_r_67;
t.c:50:16: note: children 0x1e7fc4f0 0x1e7fc390
t.c:50:16: note: node 0x1e7fc4f0 (max_nunits=2, refcnt=1) const vector(2)
double
t.c:50:16: note: op template: p_ij_x_63 = p_i_x_53 - _13;
t.c:50:16: note: [l*]stmt 0 p_ij_x_63 = p_i_x_53 - _13;
t.c:50:16: note: [l*]stmt 1 p_ij_y_64 = p_i_y_54 - _14;
t.c:50:16: note: children 0x1e7fc700 0x1e7fc9c0
t.c:50:16: note: node 0x1e7fc700 (max_nunits=2, refcnt=1) const vector(2)
double
t.c:50:16: note: op template: p_i_x_53 = _1 + _2;
t.c:50:16: note: stmt 0 p_i_x_53 = _1 + _2;
t.c:50:16: note: stmt 1 p_i_y_54 = _3 + _4;
t.c:50:16: note: children 0x1e7fc7b0 0x1e7fc860
t.c:50:16: note: node 0x1e7fc7b0 (max_nunits=2, refcnt=1) const vector(2)
double
t.c:50:16: note: op template: _1 = *params_51(D).offset_x;
t.c:50:16: note: stmt 0 _1 = *params_51(D).offset_x;
t.c:50:16: note: stmt 1 _3 = *params_51(D).offset_y;
t.c:50:16: note: node 0x1e7fc860 (max_nunits=2, refcnt=1) const vector(2)
double
t.c:50:16: note: op template: _2 = *p_i_52(D).position.x;
t.c:50:16: note: stmt 0 _2 = *p_i_52(D).position.x;
t.c:50:16: note: stmt 1 _4 = *p_i_52(D).position.y;
t.c:50:16: note: node 0x1e7fc9c0 (max_nunits=2, refcnt=1) const vector(2)
double
t.c:50:16: note: op template: _13 = *p_j_60.position.x;
t.c:50:16: note: stmt 0 _13 = *p_j_60.position.x;
t.c:50:16: note: stmt 1 _14 = *p_j_60.position.y;
t.c:50:16: note: node (external) 0x1e7fc390 (max_nunits=1, refcnt=1) const
vector(2) double
t.c:50:16: note: { force_r_67, force_r_67 }
t.c:50:16: note: stmt considered live: tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: because of use in: _28 = _27 + tmp_x_68;
t.c:50:16: note: stmt considered live: tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: because of use in: _25 = p_ij_z_65 * tmp_x_68;
t.c:50:16: note: stmt considered live: tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: because of use in: _22 = p_ij_y_64 * tmp_x_68;
t.c:50:16: note: stmt considered live: tmp_x_68 = p_ij_x_63 * force_r_67;
t.c:50:16: note: because of use in: _19 = p_ij_x_63 * tmp_x_68;
t.c:50:16: note: Cost model analysis:
_3 + _4 1 times scalar_stmt costs 8 in body
*p_i_52(D).position.y 1 times scalar_load costs 12 in body
*params_51(D).offset_y 1 times scalar_load costs 12 in body
*params_51(D).offset_x 1 times unaligned_load (misalign -1) costs 20 in body
*p_i_52(D).position.x 1 times unaligned_load (misalign -1) costs 20 in body
_1 + _2 1 times vector_stmt costs 8 in body
t.c:50:16: note: Cost model analysis for part in loop 0:
Vector cost: 48
Scalar cost: 32
t.c:50:16: missed: not vectorized: vectorization is not profitable.
where the issue is that we do not include the virial_* stores in the SLP
and thus neither are the
.. += tmp_y * p_ij_y
computations vectorized nor the live lane extracts handled. In the
testcase the virial_* stores are not contiguous as they go in via
parameters. How's that in the original? There's also no store-motion
done to turn those into loop-carried reductions due to aliasing.
Possibly the testcase is oversimplified?
The inability to put down a lane extract for one of the lanes might
be the reason this is considered unprofitable.