[PATCH] Prefer bit-test over the jump table.

Jeff Law law@redhat.com
Tue Nov 17 01:05:38 GMT 2020



On 11/16/20 2:53 AM, Martin Liška wrote:
> On 11/9/20 4:56 PM, Jeff Law wrote:
>>
>> On 11/9/20 7:24 AM, Martin Liška wrote:
>>> Hello.
>>>
>>> As mentioned in the PR, we used to prefer BT over JT in switch
>>> expansion.
>>> I restore the behavior to that.
>>>
>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>
>>> Ready to be installed?
>>> Thanks,
>>> Martin
>>>
>>> gcc/ChangeLog:
>>>
>>>     PR tree-optimization/97736
>>>     * tree-switch-conversion.c
>>> (switch_decision_tree::analyze_switch_statement):
>>>     Prefer bit tests.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     PR tree-optimization/97736
>>>     * gcc.dg/tree-ssa/switch-1.c: Prefer bit tests.
>>>     * g++.dg/tree-ssa/pr97736.C: New test.
>>
>> [ ... ]
>>
>>
>>> ---
>>> diff --git a/gcc/tree-switch-conversion.c
>>> b/gcc/tree-switch-conversion.c
>>> index 426462e856b..a7c5df31743 100644
>>> --- a/gcc/tree-switch-conversion.c
>>> +++ b/gcc/tree-switch-conversion.c
>>> @@ -1743,8 +1743,8 @@ switch_decision_tree::analyze_switch_statement ()
>>> Â
>>>    reset_out_edges_aux (m_switch);
>>> Â
>>> -  /* Find jump table clusters.  */
>>> -  vec<cluster *> output = jump_table_cluster::find_jump_tables
>>> (clusters);
>>> +  /* Find bit-test clusters.  */
>>> +  vec<cluster *> output = bit_test_cluster::find_bit_tests
>>> (clusters);
>>> Â
>>>    /* Find bit test clusters.  */
>>
>>                 ^^^
>>
>>
>> Doesn't the "bit test clusters" need to change too?  OK with that
>> nit fixed.
>
> Yep, fixed that.
>
> Btw. Jeff, I noticed your email client is sending weird 'Â' characters
> as can
> be seen also here:
> https://gcc.gnu.org/pipermail/gcc-patches/2020-November/558502.html
>
> Can you please take a look?
Yea, not sure where they're coming from.  There's some stuff in T-bird
since I upgraded to F33 that I just don't understand.  I've made some
adjustments to its configuration, but I've got no confidence I've found
the root cause.

I'd really just prefer all the colorization and html-mail crap get
turned into old-fashioned ">" indentation and the html nonsense just go
away.

jeff



More information about the Gcc-patches mailing list