[gimple-classes, committed 19/44] tree-data-ref.c: Use gassign

David Malcolm dmalcolm@redhat.com
Thu Nov 6 14:53:00 GMT 2014


gcc/ChangeLog.gimple-classes:
	* tree-data-ref.c (split_constant_offset_1): Replace check against
	GIMPLE_ASSIGN with a dyn_cast, strengthening local "def_stmt" from
	gimple to gassign *.
	(get_references_in_stmt): Likewise, introducing local
	"assign_stmt" and using it in place of "stmt" for typesafety.
---
 gcc/ChangeLog.gimple-classes |  8 ++++++++
 gcc/tree-data-ref.c          | 11 ++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f7921d6..e878e84 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,13 @@
 2014-11-03  David Malcolm  <dmalcolm@redhat.com>
 
+	* tree-data-ref.c (split_constant_offset_1): Replace check against
+	GIMPLE_ASSIGN with a dyn_cast, strengthening local "def_stmt" from
+	gimple to gassign *.
+	(get_references_in_stmt): Likewise, introducing local
+	"assign_stmt" and using it in place of "stmt" for typesafety.
+
+2014-11-03  David Malcolm  <dmalcolm@redhat.com>
+
 	* tree-call-cdce.c (check_pow): Replace check against
 	GIMPLE_ASSIGN with a dyn_cast, strengthening local "base_def" from
 	gimple to gassign *.
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 4a16c3a..6a57cec 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -674,10 +674,11 @@ split_constant_offset_1 (tree type, tree op0, enum tree_code code, tree op1,
 
     case SSA_NAME:
       {
-	gimple def_stmt = SSA_NAME_DEF_STMT (op0);
+	gassign *def_stmt;
 	enum tree_code subcode;
 
-	if (gimple_code (def_stmt) != GIMPLE_ASSIGN)
+	def_stmt = dyn_cast <gassign *> (SSA_NAME_DEF_STMT (op0));
+	if (!def_stmt)
 	  return false;
 
 	var0 = gimple_assign_rhs1 (def_stmt);
@@ -4406,11 +4407,11 @@ get_references_in_stmt (gimple stmt, vec<data_ref_loc, va_heap> *references)
   if (!gimple_vuse (stmt))
     return clobbers_memory;
 
-  if (stmt_code == GIMPLE_ASSIGN)
+  if (gassign *assign_stmt = dyn_cast <gassign *> (stmt))
     {
       tree base;
-      op0 = gimple_assign_lhs (stmt);
-      op1 = gimple_assign_rhs1 (stmt);
+      op0 = gimple_assign_lhs (assign_stmt);
+      op1 = gimple_assign_rhs1 (assign_stmt);
 
       if (DECL_P (op1)
 	  || (REFERENCE_CLASS_P (op1)
-- 
1.7.11.7



More information about the Gcc-patches mailing list