https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70171
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2016-03-11
Component|c++ |tree-optimization
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot
gnu.org
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is the C++ frontends work:
;; Function S struct_ternary(S, S, bool) (null)
;; enabled by -tree-original
<<cleanup_point return <retval> = TARGET_EXPR <D.2294, *(const struct S &)
(select ? &a : &b)>>>;
and while we have a pass that cleans this up for scalars it refuses to
operate on aggregates (because it tries to use a PHI in the transform).
Thus phiprop could handle this case emitting non-SSA code here and
do this for aggregates with non-BLKmode. Basically transform
<bb 2>:
if (select_2(D) != 0)
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
<bb 4>:
# iftmp.1_1 = PHI <&a(2), &b(3)>
D.2322 = MEM[(const struct S &)iftmp.1_1];
into
<bb 2>:
if (select_2(D) != 0)
goto <bb 5>;
else
goto <bb 3>;
<bb 3>:
D.2322 = b;
goto <bb 5>;
<bb 5>:
D.2322 = a;
<bb 4>:
Let me try to tackle this for GCC 7.