[Bug tree-optimization/79472] [7 Regression] x86-64: Switch table generation fails if default case has different code
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 13 09:41:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79472
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
GCC 6:
void frobulate_for_gcc(uint32_t) (uint32_t v)
{
const char * s;
<bb 2>:
switch (v_2(D)) <default: <L3>, case 0: <L7>, case 1: <L1>, case 2: <L2>>
<L1>:
goto <bb 6> (<L7>);
<L2>:
goto <bb 6> (<L7>);
<L3>:
# s_1 = PHI <"foo"(2), "bar"(3), "spam"(4), 0B(5)>
<L7>:
if (s_1 == 0B)
goto <bb 7>;
else
goto <bb 8>;
<bb 7>:
abort ();
<bb 8>:
__builtin_puts (s_1);
return;
}
GCC7:
Bailing out - no common successor to all case label target blocks found
--------------------------------
void frobulate_for_gcc(uint32_t) (uint32_t v)
{
const char * s;
<bb 2> [0.00%]:
switch (v_2(D)) <default: <L9> [0.00%], case 0: <L7> [0.00%], case 1: <L1>
[0.00%], case 2: <L2> [0.00%]>
<L1> [0.00%]:
goto <bb 5> (<L7>); [0.00%]
<L2> [0.00%]:
# s_1 = PHI <"foo"(2), "bar"(3), "spam"(4)>
<L7> [0.00%]:
__builtin_puts (s_1);
return;
<L9> [0.00%]:
abort ();
}
Looks that early jump threading transforms frobulate_for_gcc case to frobulate.
Well, I guess we can improve switchconv to handle cases, where a case contains
a noreturn call.
Honza?
More information about the Gcc-bugs
mailing list