diff mbox

Fix PR56521

Message ID alpine.LNX.2.00.1303051249400.3543@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener March 5, 2013, 11:51 a.m. UTC
VN now inserts all sorts of calls into the references hashtable,
not only those which produce a value.  This results in missing
initializations of ->value_id which eventually PRE ends up
accessing.

The following fixes that.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Richard.

2013-03-05  Richard Biener  <rguenther@suse.de>

	* tree-ssa-sccvn.c (set_value_id_for_result): For a NULL
	result set a new value-id.

Comments

Jakub Jelinek March 5, 2013, 11:54 a.m. UTC | #1
On Tue, Mar 05, 2013 at 12:51:09PM +0100, Richard Biener wrote:
> VN now inserts all sorts of calls into the references hashtable,
> not only those which produce a value.  This results in missing
> initializations of ->value_id which eventually PRE ends up
> accessing.
> 
> The following fixes that.
> 
> Bootstrap and regtest pending on x86_64-unknown-linux-gnu.
> 
> Richard.
> 
> 2013-03-05  Richard Biener  <rguenther@suse.de>
> 
> 	* tree-ssa-sccvn.c (set_value_id_for_result): For a NULL
> 	result set a new value-id.
> 
> --- gcc/tree-ssa-sccvn.c	(revision 196451)
> +++ gcc/tree-ssa-sccvn.c	(working copy)
> @@ -3954,7 +3962,7 @@ free_scc_vn (void)
>    XDELETE (optimistic_info);
>  }
>  
> -/* Set *ID if we computed something useful in RESULT.  */
> +/* Set *ID according to RESULT.  */
>  
>  static void
>  set_value_id_for_result (tree result, unsigned int *id)
> @@ -3966,6 +3974,8 @@ set_value_id_for_result (tree result, un
>        else if (is_gimple_min_invariant (result))
>  	*id = get_or_alloc_constant_value_id (result);

This still won't initialize *id if result is non-NULL, but isn't
SSA_NAME nor is_gimple_min_invariant.  Can't you do the same for that case
too, just in case (perhaps we can't trigger that right now, but still
it would make me feel safer about that).

>      }
> +  else
> +    *id = get_next_value_id ();
>  }
>  
>  /* Set the value ids in the valid hash tables.  */

Otherwise looks good to me, thanks.

	Jakub
diff mbox

Patch

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c	(revision 196451)
+++ gcc/tree-ssa-sccvn.c	(working copy)
@@ -3954,7 +3962,7 @@  free_scc_vn (void)
   XDELETE (optimistic_info);
 }
 
-/* Set *ID if we computed something useful in RESULT.  */
+/* Set *ID according to RESULT.  */
 
 static void
 set_value_id_for_result (tree result, unsigned int *id)
@@ -3966,6 +3974,8 @@  set_value_id_for_result (tree result, un
       else if (is_gimple_min_invariant (result))
 	*id = get_or_alloc_constant_value_id (result);
     }
+  else
+    *id = get_next_value_id ();
 }
 
 /* Set the value ids in the valid hash tables.  */