On Tue, Oct 25, 2011 at 2:15 PM, Tom de Vries <tom_devr...@mentor.com> wrote:
> Richard,
>
> I have a patch for the i686 bootstrap problem reported in PR50763 comment 10.
>
> pr50763-2.c looks like this before tail_merge_optimize:
> ...
> std_canonical_va_list_type (union tree_node * typeD.1608)
> {
>  _BoolD.1576 pretmp.6D.2739;
>  union tree_node * pretmp.5D.2738;
>  _BoolD.1576 pretmp.4D.2737;
>  union tree_node * pretmp.3D.2736;
>  intD.6 D.2734;
>  _BoolD.1576 D.2733;
>  union tree_node * D.2725;
>  intD.6 D.2722;
>  intD.6 D.2717;
>
>  # BLOCK 2 freq:10000
>  # PRED: ENTRY [100.0%]  (fallthru,exec)
>  # VUSE <.MEMD.2730_12(D)>
>  D.2717_4 = typeD.1608_3(D)->baseD.1605.codeD.1597;
>  if (D.2717_4 != 0)
>    goto <bb 3>;
>  else
>    goto <bb 4>;
>  # SUCC: 3 [50.0%]  (true,exec) 4 [50.0%]  (false,exec)
>
>  # BLOCK 3 freq:5000
>  # PRED: 2 [50.0%]  (true,exec)
>  # VUSE <.MEMD.2730_12(D)>
>  # PT = anything
>  typeD.1608_5 = typeD.1608_3(D)->typedD.1606.typeD.1600;
>  goto <bb 6>;
>  # SUCC: 6 [100.0%]  (fallthru,exec)
>
>  # BLOCK 4 freq:5000
>  # PRED: 2 [50.0%]  (false,exec)
>  # VUSE <.MEMD.2730_12(D)>
>  # PT = anything
>  typeD.1608_6 = typeD.1608_3(D)->typedD.1606.typeD.1600;
>  # VUSE <.MEMD.2730_12(D)>
>  D.2722_7 = typeD.1608_6->baseD.1605.codeD.1597;
>  if (D.2722_7 != 0)
>    goto <bb 5>;
>  else
>    goto <bb 7>;
>  # SUCC: 5 [50.0%]  (true,exec) 7 [50.0%]  (false,exec)
>
>  # BLOCK 7 freq:2500
>  # PRED: 4 [50.0%]  (false,exec)
>  goto <bb 6>;
>  # SUCC: 6 [100.0%]  (fallthru)
>
>  # BLOCK 5 freq:2500
>  # PRED: 4 [50.0%]  (true,exec)
>  # SUCC: 6 [100.0%]  (fallthru,exec)
>
>  # BLOCK 6 freq:10000
>  # PRED: 3 [100.0%]  (fallthru,exec) 7 [100.0%]  (fallthru) 5 [100.0%]
> (fallthru,exec)
>  # PT = anything
>
>  # typeD.1608_1 = PHI <typeD.1608_5(3), typeD.1608_3(D)(7), typeD.1608_6(5)>
>  # VUSE <.MEMD.2730_12(D)>
>  # PT = anything
>  D.2725_9 = typeD.1608_1->type_commonD.1607.main_variantD.1604;
>  D.2733_15 = D.2725_9 != 0B;
>  D.2734_14 = (intD.6) D.2733_15;
>  # VUSE <.MEMD.2730_12(D)>
>  return D.2734_14;
>  # SUCC: EXIT [100.0%]
>
> }
> ...
>
> tail_merge_optimize discovers that block 3 and 5 are identical, and removes 
> block 5.
> In replace_block_by, we end up with phi_vuse1 == NULL_TREE and
> phi_vuse2 == .MEMD.2730_12(D).
>
> After the original fix to PR50763, this forces us to update the vuses, while
> that is not necessary.
>
> Attached patch fixes this problem by determining more precisely when the vuses
> need to be updated.
>
> bootstrapped and reg-tested on x86_64 and i686.
>
> OK for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> - Tom
>
> 2011-10-25  Tom de Vries  <t...@codesourcery.com>
>
>        PR tree-optimization/50763
>        * tree-ssa-tail-merge.c (replace_block_by): Update vops if phi_vuse1 or
>        phi_vuse2 is NULL_TREE only if bb1 dominates or is dominated by bb2.
>
>        * gcc.dg/pr50763-2.c: New test.
>

Reply via email to