From 2fa2d802da69601c9945dbb988aa29e5567bd8d5 Mon Sep 17 00:00:00 2001
From: Dorit Naishlos <dorit@il.ibm.com>
Date: Mon, 22 Nov 2004 13:41:57 +0000
Subject: [PATCH] re PR tree-optimization/18544 (ICE with -ftree-vectorize)

	PR tree-opt/18544
        * tree-vectorizer.c (vect_analyze_data_refs): Fail if memtag not found.

From-SVN: r91011
---
 gcc/ChangeLog         |  5 +++++
 gcc/tree-vectorizer.c | 13 +++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e130c9198eb..a1666ee1e1c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-22  Dorit Naishlos  <dorit@il.ibm.com>
+
+	PR tree-opt/18544
+	* tree-vectorizer.c (vect_analyze_data_refs): Fail if memtag not found.
+
 2004-11-22 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
 
 	* config.gcc: Use t-slibgcc-elf to build libgcc_s.so on
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 7793b0b6b010..61c22e825944 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -5057,10 +5057,15 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
 		case ARRAY_REF:
 		  dr = analyze_array (stmt, TREE_OPERAND (symbl, 0), 
 				      DR_IS_READ(dr));
-		  STMT_VINFO_MEMTAG (stmt_info) = 
-		     vect_get_base_and_bit_offset (dr, DR_BASE_NAME (dr), NULL_TREE,
-						   loop_vinfo, &offset, 
-						   &base_aligned_p);
+		  tag = vect_get_base_and_bit_offset (dr, DR_BASE_NAME (dr), 
+			   NULL_TREE, loop_vinfo, &offset, &base_aligned_p);
+		  if (!tag)
+		    {
+		      if (vect_debug_stats (loop) || vect_debug_details (loop))
+			fprintf (dump_file, "not vectorized: no memtag for ref.");
+		      return false;
+		    }
+		  STMT_VINFO_MEMTAG (stmt_info) = tag; 
 		  break;
 		  
 		case VAR_DECL: 
-- 
GitLab