[Bug middle-end/91606] [9/10 regression] Optimization leads to invalid code
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 30 15:25:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91606
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is miscompiled during dse1 (or the IL is already wrong earlier).
Before dse1 we have in bb2
<bb 2> :
D.10827._M_elems[0].D.10649.f1.__pfn = fun1;
D.10827._M_elems[0].D.10649.f1.__delta = 0;
D.10827._M_elems[0].index = 0;
D.10827._M_elems[1].D.10649.f2.__pfn = fun2;
D.10827._M_elems[1].D.10649.f2.__delta = 0;
D.10827._M_elems[1].index = 1;
<bb 3> :
# idx_6 = PHI <0(2), idx_27(9)>
# __for_begin_7 = PHI <&MEM <struct variant[2]> [(void *)&D.10827](2),
__for_begin_28(9)>
if (&MEM <struct variant[2]> [(void *)&D.10827 + 48B] == __for_begin_7)
goto <bb 10>; [INV]
else
goto <bb 4>; [INV]
<bb 4> :
_18 = MEM[(const struct variant *)__for_begin_7].index;
if (_18 != 0)
goto <bb 9>; [17.38%]
else
goto <bb 5>; [82.62%]
<bb 5> :
_31 = &MEM[(const struct variant *)__for_begin_7].D.10649.f1;
_1 = _31->__pfn;
_2 = memFuncPtr.__pfn;
if (_1 == _2)
and so in the first iteration it goes bb2, bb3, bb4 and bb5 and bb5 reads
_31->__pfn and thus D.10827._M_elems[0].D.10649.f1, but DSE1 removes the
D.10827._M_elems[0].D.10649.f1.__pfn = fun1;
D.10827._M_elems[0].D.10649.f1.__delta = 0;
and
D.10827._M_elems[1].D.10649.f2.__pfn = fun2;
D.10827._M_elems[1].D.10649.f2.__delta = 0;
stores.
More information about the Gcc-bugs
mailing list