public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure
@ 2011-10-25 12:54 Tom de Vries
  2011-10-25 22:06 ` H.J. Lu
  2011-10-26 10:19 ` Richard Guenther
  0 siblings, 2 replies; 5+ messages in thread
From: Tom de Vries @ 2011-10-25 12:54 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2657 bytes --]

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?

Thanks,
- Tom

2011-10-25  Tom de Vries  <tom@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.

[-- Attachment #2: pr50763-2.patch --]
[-- Type: text/x-patch, Size: 1687 bytes --]

Index: gcc/tree-ssa-tail-merge.c
===================================================================
--- gcc/tree-ssa-tail-merge.c (revision 180375)
+++ gcc/tree-ssa-tail-merge.c (working copy)
@@ -1551,7 +1551,12 @@ replace_block_by (basic_block bb1, basic
       phi_vuse1 = vop_at_entry (bb1);
 
       /* If both are not found, it means there's no need to update.  */
-      update_vops = phi_vuse1 != NULL_TREE || phi_vuse2 != NULL_TREE;
+      if (phi_vuse1 == NULL_TREE && phi_vuse2 == NULL_TREE)
+	update_vops = false;
+      else if (phi_vuse1 == NULL_TREE)
+	update_vops = dominated_by_p (CDI_DOMINATORS, bb1, bb2);
+      else if (phi_vuse2 == NULL_TREE)
+	update_vops = dominated_by_p (CDI_DOMINATORS, bb2, bb1);
     }
 
   if (phi_vuse1 && gimple_bb (SSA_NAME_DEF_STMT (phi_vuse1)) == bb1)
Index: gcc/testsuite/gcc.dg/pr50763-2.c
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/gcc.dg/pr50763-2.c (revision 0)
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef union tree_node *tree;
+
+struct tree_base
+{
+  int code;
+};
+
+struct tree_typed
+{
+  struct tree_base base;
+  tree type;
+};
+
+struct tree_common
+{
+  struct tree_typed typed;
+};
+
+struct tree_type_common
+{
+  tree main_variant;
+};
+
+union tree_node
+{
+  struct tree_base base;
+  struct tree_typed typed;
+  struct tree_type_common type_common;
+};
+
+int std_canonical_va_list_type (tree type)
+{
+  if (type->base.code)
+    type = type->typed.type;
+  else
+    if (type->typed.type->base.code)
+      type = type->typed.type;
+
+  if (type->type_common.main_variant)
+    return 1;
+
+  return 0;
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure
  2011-10-25 12:54 [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure Tom de Vries
@ 2011-10-25 22:06 ` H.J. Lu
  2011-10-26 10:19 ` Richard Guenther
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2011-10-25 22:06 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Richard Guenther, gcc-patches

On Tue, Oct 25, 2011 at 5:15 AM, Tom de Vries <Tom_deVries@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?
>
> Thanks,
> - Tom
>
> 2011-10-25  Tom de Vries  <tom@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.
>

Does this fix

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50867

-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure
  2011-10-25 12:54 [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure Tom de Vries
  2011-10-25 22:06 ` H.J. Lu
@ 2011-10-26 10:19 ` Richard Guenther
  2011-11-02 18:05   ` Tom de Vries
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2011-10-26 10:19 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gcc-patches

On Tue, Oct 25, 2011 at 2:15 PM, Tom de Vries <Tom_deVries@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  <tom@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.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure
  2011-10-26 10:19 ` Richard Guenther
@ 2011-11-02 18:05   ` Tom de Vries
  2011-11-04 17:39     ` Tom de Vries
  0 siblings, 1 reply; 5+ messages in thread
From: Tom de Vries @ 2011-11-02 18:05 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2904 bytes --]

On 10/26/2011 10:38 AM, Richard Guenther wrote:
> On Tue, Oct 25, 2011 at 2:15 PM, Tom de Vries <Tom_deVries@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.
> 

Committed additional testcase from duplicate PR50854.

Thanks,
- Tom

2011-11-02  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/50763
	* g++.dg/pr50763-3.C: New test.

[-- Attachment #2: pr50763.test.2.patch --]
[-- Type: text/x-patch, Size: 1358 bytes --]

Index: gcc/testsuite/g++.dg/pr50763-3.C
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/g++.dg/pr50763-3.C (revision 0)
@@ -0,0 +1,57 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+class v2d {
+public:
+   double x;
+   double y;
+};
+
+class v3d {
+public:
+   double x;
+   v3d() {}
+   v3d(const v2d & cr2Dv) {}
+};
+
+class e2d {
+protected:
+   v2d _Min;
+   v2d _Max;
+public:
+   int cop2d(const v2d & rPnt) const;
+   v2d clp2d(const v2d & rPnt) const;
+};
+
+inline int e2d::cop2d(const v2d & rPnt) const {
+   int bRet = 1;
+   if (rPnt.x < _Min.x) bRet = 0;
+   else if (rPnt.x > _Max.x) bRet = 0;
+   else if (rPnt.y > _Max.y) bRet = 0;
+   return bRet;
+}
+
+inline v2d e2d::clp2d(const v2d & rPnt) const {
+   v2d sRet = rPnt;
+   if (rPnt.x < _Min.x) sRet.x = _Min.x;
+   if (rPnt.y < _Min.y) sRet.y = _Min.y;
+   if (rPnt.x > _Max.x) sRet.x = _Max.x;
+   if (rPnt.y > _Max.y) sRet.y = _Max.y;
+   return sRet;
+}
+
+class sExt {
+protected:
+   e2d _Dom;
+   long eval() const;
+   long evalPoint(const v2d & crUV, v3d & rPnt) const;
+};
+
+long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const {
+   v3d sUV = crUV;
+   if (!_Dom.cop2d(crUV)) {
+      sUV = _Dom.clp2d(crUV);
+   }
+   eval();
+}   

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure
  2011-11-02 18:05   ` Tom de Vries
@ 2011-11-04 17:39     ` Tom de Vries
  0 siblings, 0 replies; 5+ messages in thread
From: Tom de Vries @ 2011-11-04 17:39 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3119 bytes --]

On 11/02/2011 07:02 PM, Tom de Vries wrote:
> On 10/26/2011 10:38 AM, Richard Guenther wrote:
>> On Tue, Oct 25, 2011 at 2:15 PM, Tom de Vries <Tom_deVries@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.
>>
> 
> Committed additional testcase from duplicate PR50854.
> 

Committed 2 additional test-cases.

Thanks,
- Tom

2011-11-04  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/50763
	* g++.dg/pr50763-4.C: New test.
	* gcc.dg/pr50763-5.c: New test.



[-- Attachment #2: pr50763.test.3.patch --]
[-- Type: text/x-patch, Size: 852 bytes --]

Index: gcc/testsuite/g++.dg/pr50763-4.C
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/g++.dg/pr50763-4.C (revision 0)
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+float
+clamp (const float x)
+{
+  return x <= 1 ? 1 : x;
+}
+
+template < class T > struct VECTOR
+{
+  float x;
+};
+template < class TV > class JOINT
+{
+  virtual void Constrain_Angles (VECTOR < float >&angles) const;
+};
+
+template < class TV > class ANGLE_JOINT:public JOINT < TV >
+{
+  virtual ~ ANGLE_JOINT ()
+  {
+  }
+  void Constrain_Angles (VECTOR < float >&angles) const
+  {
+    VECTOR < float >v;
+    if (v.x)
+        v.x = clamp (angles.x);
+    else
+        v.x = angles.x;
+      angles.x = v.x;
+  }
+};
+template ANGLE_JOINT < int >::~ANGLE_JOINT ();

[-- Attachment #3: pr50763.test.4.patch --]
[-- Type: text/x-patch, Size: 678 bytes --]

Index: gcc/testsuite/gcc.dg/pr50763-5.c
===================================================================
--- /dev/null (new file)
+++ gcc/testsuite/gcc.dg/pr50763-5.c (revision 0)
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-tail-merge" } */
+
+struct inode
+{
+  unsigned short i_mode;
+  unsigned int i_flags;
+};
+
+static inline int
+is_sxid (unsigned int mode)
+{
+  return (mode & 0004000) || ((mode & 0002000) && (mode & 00010));
+};
+
+void
+gfs2_set_inode_flags (int ip, struct inode *inode)
+{
+  unsigned int flags = inode->i_flags;
+  if ((ip == 0) && !is_sxid (inode->i_mode))
+    inode->i_flags |= 4096;
+  inode->i_flags = flags;
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-04 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 12:54 [PATCH,PR50763] Follow-up patch to fix i686 bootstrap failure Tom de Vries
2011-10-25 22:06 ` H.J. Lu
2011-10-26 10:19 ` Richard Guenther
2011-11-02 18:05   ` Tom de Vries
2011-11-04 17:39     ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).