This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ifcvt/crossjump patch: Fix PR 42496, 21803


Crap, this is so not my day!

On Tue, Apr 20, 2010 at 12:14 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> ?On Tue, Apr 20, 2010 at 12:05 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> Here's the second part. ?This one should help most architectures, not
>>> just the ones with conditional execution. ?I've observed it helps on
>>> i686 and arm, with the following being a typical result:
>>>
>>> ?.L18:
>>> ? ? ? ? ldr ? ? r1, [r2, #4]
>>> ? ? ? ? cmp ? ? r1, #34
>>> - ? ? ? it ? ? ?hi
>>> - ? ? ? ldrhi ? r3, .L98+12
>>> - ? ? ? bhi ? ? .L28
>>> ? ? ? ? ldr ? ? r3, .L98+12
>>> + ? ? ? bhi ? ? .L28
>>> ? ? ? ? ldrb ? ?r2, [r3, #4] ? ?@ zero_extendqisi2
>>> ? ? ? ? cbz ? ? r2, .L29
>>> ? ? ? ? ldr ? ? r3, [r3, #8]
>>
>> I'm uncomfortable with this patch because I'm not sure it belongs in ifcvt.c.
>> Conceptually it's a reversed form of cross jumping so it could be implemented
>> more generally in cfgcleanup.c.
>
> I have a patch somewhere for this "head merging" (opposite of tail
> merging). It implements this in cfgcleanup.c. I intend to finish it in
> this stage1 cycle. It needs a bit of TLC but it's conceptually quite
> easy.
>
>> ?And other transformations should already be
>> able to apply this kind of optimizations. ?Do you have testcases?
>
> I originally wrote my patch for gtype-desc.c (in the build directory).
> There are lots of cases for head-merging calls to the marker functions
> there. See

As I was saying: see gt_ggc_mx_gimple_statement_d for example:

      switch (gimple_statement_structure (&((*x))))
        {
        case GSS_BASE:
          gt_ggc_m_15basic_block_def ((*x).gsbase.bb);
          gt_ggc_m_9tree_node ((*x).gsbase.block);
          break;
        case GSS_WITH_OPS:
          gt_ggc_m_15basic_block_def ((*x).gsops.opbase.gsbase.bb);
          gt_ggc_m_9tree_node ((*x).gsops.opbase.gsbase.block);
          {
            size_t i0;
            size_t l0 = (size_t)(((*x).gsops).opbase.gsbase.num_ops);
            for (i0 = 0; i0 != l0; i0++) {
              gt_ggc_m_9tree_node ((*x).gsops.op[i0]);
            }
          }
          break;
        case GSS_WITH_MEM_OPS_BASE:
          gt_ggc_m_15basic_block_def ((*x).gsmembase.opbase.gsbase.bb);
          gt_ggc_m_9tree_node ((*x).gsmembase.opbase.gsbase.block);
          break;
       etc.

In all case labels, the first two calls can be merged. My patch used
to handle cases like this back when I hacked it (early ~gcc 4.4). I
don't know if this happens in code written by human, but IIRC there
are situations like this in Brad Lucier's Scheme interpreter, too.

Sorry for the many posts. I had my mouse pointer hovering over the
"send" button :-(

Ciao!
Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]