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

        * omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt",
        from a checked cast to gimple_call within the "case GIMPLE_CALL",
        for the regions where "stmt" is not subsequently overwritten.
---
 gcc/gimple.h  |  7 +++----
 gcc/omp-low.c | 12 +++++++-----
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gcc/gimple.h b/gcc/gimple.h
index fb7b5d3..328fdf3 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2922,13 +2922,12 @@ gimple_call_fntype (const_gimple gs)
   return call_stmt->u.fntype;
 }
 
-/* Set the type of the function called by GS to FNTYPE.  */
+/* Set the type of the function called by CALL_STMT to FNTYPE.  */
 
 static inline void
-gimple_call_set_fntype (gimple gs, tree fntype)
+gimple_call_set_fntype (gimple_call call_stmt, tree fntype)
 {
-  gimple_statement_call *call_stmt = as_a <gimple_statement_call> (gs);
-  gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
+  gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
   call_stmt->u.fntype = fntype;
 }
 
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 5ae014c..790e132 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -9998,6 +9998,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context 
*ctx)
 {
   gimple stmt = gsi_stmt (*gsi_p);
   struct walk_stmt_info wi;
+  gimple_call call_stmt;
 
   if (gimple_has_location (stmt))
     input_location = gimple_location (stmt);
@@ -10113,7 +10114,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context 
*ctx)
       break;
     case GIMPLE_CALL:
       tree fndecl;
-      fndecl = gimple_call_fndecl (stmt);
+      call_stmt = stmt->as_a_gimple_call ();
+      fndecl = gimple_call_fndecl (call_stmt);
       if (fndecl
          && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
        switch (DECL_FUNCTION_CODE (fndecl))
@@ -10128,7 +10130,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context 
*ctx)
            cctx = ctx;
            if (gimple_code (cctx->stmt) == GIMPLE_OMP_SECTION)
              cctx = cctx->outer;
-           gcc_assert (gimple_call_lhs (stmt) == NULL_TREE);
+           gcc_assert (gimple_call_lhs (call_stmt) == NULL_TREE);
            if (!cctx->cancellable)
              {
                if (DECL_FUNCTION_CODE (fndecl)
@@ -10144,10 +10146,10 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context 
*ctx)
            if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_GOMP_BARRIER)
              {
                fndecl = builtin_decl_explicit (BUILT_IN_GOMP_BARRIER_CANCEL);
-               gimple_call_set_fndecl (stmt, fndecl);
-               gimple_call_set_fntype (stmt, TREE_TYPE (fndecl));
+               gimple_call_set_fndecl (call_stmt, fndecl);
+               gimple_call_set_fntype (call_stmt, TREE_TYPE (fndecl));
              }
-           gimple_call_set_lhs (stmt, lhs);
+           gimple_call_set_lhs (call_stmt, lhs);
            tree fallthru_label;
            fallthru_label = create_artificial_label (UNKNOWN_LOCATION);
            gimple g;
-- 
1.8.5.3

Reply via email to