diff mbox

[COMMITTED] PR63676, exit tree fold when node be TREE_CLOBBER_P

Message ID 545CA938.5030604@arm.com
State New
Headers show

Commit Message

Jiong Wang Nov. 7, 2014, 11:12 a.m. UTC
On 07/11/14 10:57, Tejas Belagod wrote:
> On 07/11/14 10:35, Richard Biener wrote:
>> On Fri, Nov 7, 2014 at 11:22 AM, Jiong Wang <jiong.wang@arm.com> wrote:
>>> ok to trunk?
>> Please instead guard the GIMPLE_SINGLE_RHS case in fold_gimple_assign
>> instead, like
>>
>> Index: gcc/gimple-fold.c
>> ===================================================================
>> --- gcc/gimple-fold.c   (revision 217213)
>> +++ gcc/gimple-fold.c   (working copy)
>> @@ -320,6 +320,9 @@
>>          {
>>            tree rhs = gimple_assign_rhs1 (stmt);
>>
>> +       if (TREE_CLOBBER_P (rhs))
>> +         return NULL_TREE;
>> +
>>           if (REFERENCE_CLASS_P (rhs))
>>             return maybe_fold_reference (rhs, false);
>>
>> ok with that change.  If you like you can guard fold () as well, but please
>> inside the case CONSTRUCTOR: case only.
> But TREE_CLOBBER_P () checks for CONSTRUCTOR anyway. Does it have a
> chance of being folded between the start of fold () and the  case
> CONSTRUCTOR: given its a CLOBBER? What am I missing?

Richard, Tejas,

thanks for your comments.

I committed below patch after re-bootstrap OK and no regression on x86-64.

Have not touch fold ().  I was putting the check at the start of fold () with the
thoughts that we exit the fold as early as possible to be more efficient.

as this bug do trigger from fold_gimple_assign, it will be more efficient to fix here.

Regards,
Jiong
  


>
> Thanks,
> Tejas.
>
>
diff mbox

Patch

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 217214)
+++ gcc/gimple-fold.c	(working copy)
@@ -320,6 +320,9 @@ 
        {
          tree rhs = gimple_assign_rhs1 (stmt);
  
+	if (TREE_CLOBBER_P (rhs))
+	  return NULL_TREE;
+
  	if (REFERENCE_CLASS_P (rhs))
  	  return maybe_fold_reference (rhs, false);
  
Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 217214)
+++ gcc/ChangeLog	(working copy)
@@ -1,5 +1,12 @@ 
+2014-11-07  Jiong Wang  <jiong.wang@arm.com>
  2014-11-07  Richard Biener  <rguenther@suse.de>
  
+	PR tree-optimization/63676
+	* gimple-fold.c (fold_gimple_assign): Do not fold node when
+	TREE_CLOBBER_P be true.
+
+2014-11-07  Richard Biener  <rguenther@suse.de>
+
  	PR middle-end/63770
  	* match.pd: Guard conflicting GENERIC pattern properly.