This corresponds to:
  [PATCH 82/89] Concretize gimple_call_set_fntype
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01187.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> This is fine once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00840.html

gcc/
        * gimple.h (gimple_call_set_fn): Require a gimple_call.

        * trans-mem.c (dump_tm_memopt_transform): Likewise.
        (tm_memopt_transform_blocks): Add checked casts to gimple_call in
        suites guarded by is_tm_simple_{load|store}, which enforce that
        the statement must be a GIMPLE_CALL; use this when invoking
        dump_tm_memopt_transform.
---
 gcc/ChangeLog.gimple-classes | 12 ++++++++++++
 gcc/gimple.h                 |  3 +--
 gcc/trans-mem.c              | 14 ++++++++------
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 37e3955..ae57d57 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
 2014-10-24  David Malcolm  <dmalc...@redhat.com>
 
+       Concretize gimple_call_set_fn
+
+       * gimple.h (gimple_call_set_fn): Require a gimple_call.
+
+       * trans-mem.c (dump_tm_memopt_transform): Likewise.
+       (tm_memopt_transform_blocks): Add checked casts to gimple_call in
+       suites guarded by is_tm_simple_{load|store}, which enforce that
+       the statement must be a GIMPLE_CALL; use this when invoking
+       dump_tm_memopt_transform.
+
+2014-10-24  David Malcolm  <dmalc...@redhat.com>
+
        Tweak to gimplify_modify_expr
 
        * gimplify.c (gimplify_modify_expr): Introduce local "call_stmt".
diff --git a/gcc/gimple.h b/gcc/gimple.h
index ac6d664..a7ec1d5 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2679,9 +2679,8 @@ gimple_call_fn_ptr (const_gimple gs)
 /* Set FN to be the function called by call statement GS.  */
 
 static inline void
-gimple_call_set_fn (gimple gs, tree fn)
+gimple_call_set_fn (gimple_call gs, tree fn)
 {
-  GIMPLE_CHECK (gs, GIMPLE_CALL);
   gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
   gimple_set_op (gs, 1, fn);
 }
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 98fd3a2..bdd4a77 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -3778,7 +3778,7 @@ dump_tm_memopt_transform (gimple stmt)
 
 static void
 tm_memopt_transform_stmt (unsigned int offset,
-                         gimple stmt,
+                         gimple_call stmt,
                          gimple_stmt_iterator *gsi)
 {
   tree fn = gimple_call_fn (stmt);
@@ -3814,28 +3814,30 @@ tm_memopt_transform_blocks (vec<basic_block> blocks)
 
          if (is_tm_simple_load (stmt))
            {
+             gimple_call call_stmt = as_a <gimple_call> (stmt);
              loc = tm_memopt_value_number (stmt, NO_INSERT);
              if (store_avail && bitmap_bit_p (store_avail, loc))
-               tm_memopt_transform_stmt (TRANSFORM_RAW, stmt, &gsi);
+               tm_memopt_transform_stmt (TRANSFORM_RAW, call_stmt, &gsi);
              else if (store_antic && bitmap_bit_p (store_antic, loc))
                {
-                 tm_memopt_transform_stmt (TRANSFORM_RFW, stmt, &gsi);
+                 tm_memopt_transform_stmt (TRANSFORM_RFW, call_stmt, &gsi);
                  bitmap_set_bit (store_avail, loc);
                }
              else if (read_avail && bitmap_bit_p (read_avail, loc))
-               tm_memopt_transform_stmt (TRANSFORM_RAR, stmt, &gsi);
+               tm_memopt_transform_stmt (TRANSFORM_RAR, call_stmt, &gsi);
              else
                bitmap_set_bit (read_avail, loc);
            }
          else if (is_tm_simple_store (stmt))
            {
+             gimple_call call_stmt = as_a <gimple_call> (stmt);
              loc = tm_memopt_value_number (stmt, NO_INSERT);
              if (store_avail && bitmap_bit_p (store_avail, loc))
-               tm_memopt_transform_stmt (TRANSFORM_WAW, stmt, &gsi);
+               tm_memopt_transform_stmt (TRANSFORM_WAW, call_stmt, &gsi);
              else
                {
                  if (read_avail && bitmap_bit_p (read_avail, loc))
-                   tm_memopt_transform_stmt (TRANSFORM_WAR, stmt, &gsi);
+                   tm_memopt_transform_stmt (TRANSFORM_WAR, call_stmt, &gsi);
                  bitmap_set_bit (store_avail, loc);
                }
            }
-- 
1.8.5.3

Reply via email to