gcc/ChangeLog.gimple-classes:
        * trans-mem.c (thread_private_new_memory): Replace
        is_gimple_assign with a dyn_cast, introducing local gassign *
        "assign_stmt", using it in place of "stmt" for typesafety.
        (examine_assign_tm): Strengthen local "stmt" from gimple to
        gassign *.
        (expand_assign_tm): Likewise.
        (ipa_tm_scan_irr_block): Capture result of gimple_assign_single_p
        as a new local "assign_stmt", using it in place of "stmt" for
        typesafety.
---
 gcc/ChangeLog.gimple-classes | 12 ++++++++++++
 gcc/trans-mem.c              | 24 ++++++++++++------------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 71bb31b..e0840ed 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
 2014-11-05  David Malcolm  <dmalc...@redhat.com>
 
+       * trans-mem.c (thread_private_new_memory): Replace
+       is_gimple_assign with a dyn_cast, introducing local gassign *
+       "assign_stmt", using it in place of "stmt" for typesafety.
+       (examine_assign_tm): Strengthen local "stmt" from gimple to
+       gassign *.
+       (expand_assign_tm): Likewise.
+       (ipa_tm_scan_irr_block): Capture result of gimple_assign_single_p
+       as a new local "assign_stmt", using it in place of "stmt" for
+       typesafety.
+
+2014-11-05  David Malcolm  <dmalc...@redhat.com>
+
        * sese.c (rename_uses): Add checked cast to gassign within region
        guarded by is_gimple_assign.
        (graphite_copy_stmts_from_block): Likewise.
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 7e82de5..8806962 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -1403,23 +1403,23 @@ thread_private_new_memory (basic_block entry_block, 
tree x)
          && !dominated_by_p (CDI_DOMINATORS, gimple_bb (stmt), entry_block))
        retval = mem_thread_local;
 
-      if (is_gimple_assign (stmt))
+      if (gassign *assign_stmt = dyn_cast <gassign *> (stmt))
        {
-         code = gimple_assign_rhs_code (stmt);
+         code = gimple_assign_rhs_code (assign_stmt);
          /* x = foo ==> foo */
          if (code == SSA_NAME)
-           x = gimple_assign_rhs1 (stmt);
+           x = gimple_assign_rhs1 (assign_stmt);
          /* x = foo + n ==> foo */
          else if (code == POINTER_PLUS_EXPR)
-           x = gimple_assign_rhs1 (stmt);
+           x = gimple_assign_rhs1 (assign_stmt);
          /* x = (cast*) foo ==> foo */
          else if (code == VIEW_CONVERT_EXPR || code == NOP_EXPR)
-           x = gimple_assign_rhs1 (stmt);
+           x = gimple_assign_rhs1 (assign_stmt);
          /* x = c ? op1 : op2 == > op1 or op2 just like a PHI */
          else if (code == COND_EXPR)
            {
-             tree op1 = gimple_assign_rhs2 (stmt);
-             tree op2 = gimple_assign_rhs3 (stmt);
+             tree op1 = gimple_assign_rhs2 (assign_stmt);
+             tree op2 = gimple_assign_rhs3 (assign_stmt);
              enum thread_memory_type mem;
              retval = thread_private_new_memory (entry_block, op1);
              if (retval == mem_non_local)
@@ -1575,7 +1575,7 @@ requires_barrier (basic_block entry_block, tree x, gimple 
stmt)
 static void
 examine_assign_tm (unsigned *state, gimple_stmt_iterator *gsi)
 {
-  gimple stmt = gsi_stmt (*gsi);
+  gassign *stmt = as_a <gassign *> (gsi_stmt (*gsi));
 
   if (requires_barrier (/*entry_block=*/NULL, gimple_assign_rhs1 (stmt), NULL))
     *state |= GTMA_HAVE_LOAD;
@@ -2273,7 +2273,7 @@ build_tm_store (location_t loc, tree lhs, tree rhs, 
gimple_stmt_iterator *gsi)
 static void
 expand_assign_tm (struct tm_region *region, gimple_stmt_iterator *gsi)
 {
-  gimple stmt = gsi_stmt (*gsi);
+  gassign *stmt = as_a <gassign *> (gsi_stmt (*gsi));
   location_t loc = gimple_location (stmt);
   tree lhs = gimple_assign_lhs (stmt);
   tree rhs = gimple_assign_rhs1 (stmt);
@@ -4298,10 +4298,10 @@ ipa_tm_scan_irr_block (basic_block bb)
       switch (gimple_code (stmt))
        {
        case GIMPLE_ASSIGN:
-         if (gimple_assign_single_p (stmt))
+         if (gassign *assign_stmt = gimple_assign_single_p (stmt))
            {
-             tree lhs = gimple_assign_lhs (stmt);
-             tree rhs = gimple_assign_rhs1 (stmt);
+             tree lhs = gimple_assign_lhs (assign_stmt);
+             tree rhs = gimple_assign_rhs1 (assign_stmt);
              if (volatile_var_p (lhs) || volatile_var_p (rhs))
                return true;
            }
-- 
1.7.11.7

Reply via email to