This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix SRA WRT vector types
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Feb 2007 13:38:58 +0100
- Subject: Fix SRA WRT vector types
Hi,
this patch fixes latent bug uncovered by the addressable patch. sra_walk_expr
when seeing BITFIELD_REF of vector type is trying to mark the fact to the SRA
candidate elt. However when the BITFIELD_REF is having the vector VAR_DECL as
operand, maybe_lookup_element_for_expr returns NULL because the variable is not
going to be scalarized.
Previously we didn't hit the problem because the vector variables are hidden
in aggregates and the bug needs first SRA pass to bring the variable away from
the wrapping aggregate in order to make second SRA pass segfault.
:ADDPATCH i686-linux:
Bootstrapped/regtested i686-linux, OK?
* tree-sra.c (sra_walk_expr): Add linebreaks. BITFIELD_REFs into
vectors might cause maybe_lookup_element_for_expr to be called
on non-sra-candidate.
Index: tree-sra.c
===================================================================
--- tree-sra.c (revision 121554)
+++ tree-sra.c (working copy)
@@ -793,10 +793,13 @@ sra_walk_expr (tree *expr_p, block_stmt_
/* A bit field reference to a specific vector is scalarized but for
ones for inputs need to be marked as used on the left hand size so
when we scalarize it, we can mark that variable as non renamable. */
- if (is_output && TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0))) == VECTOR_TYPE)
+ if (is_output
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0))) == VECTOR_TYPE)
{
- struct sra_elt *elt = maybe_lookup_element_for_expr (TREE_OPERAND (inner, 0));
- elt->is_vector_lhs = true;
+ struct sra_elt *elt
+ = maybe_lookup_element_for_expr (TREE_OPERAND (inner, 0));
+ if (elt)
+ elt->is_vector_lhs = true;
}
/* A bit field reference (access to *multiple* fields simultaneously)
is not currently scalarized. Consider this an access to the