public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [gimple-classes, committed 66/92] Concretize three gimple_return_ accessors
Date: Mon, 27 Oct 2014 20:36:00 -0000	[thread overview]
Message-ID: <1414442490-14841-67-git-send-email-dmalcolm@redhat.com> (raw)
In-Reply-To: <1414442490-14841-1-git-send-email-dmalcolm@redhat.com>

This corresponds to:
  [PATCH 68/89] Concretize three gimple_return_ accessors
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01233.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> Fine once prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00865.html

gcc/
	* gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
	rather than a const_gimple.
	(gimple_return_retval): Likewise.
	(gimple_return_set_retval): Require a gimple_return.

	* cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
	gimple_return.
	(expand_gimple_basic_block): Likewise.
	* tree-complex.c (expand_complex_move): Likewise.
	(expand_complex_comparison): Likewise.
	* tree-inline.c (remap_gimple_stmt): Likewise.
	* tree-sra.c (scan_function): Likewise.
	(sra_modify_function_body): Likewise.
	(ipa_sra_modify_function_body): Likewise.
	* tree-ssa-structalias.c (find_func_aliases): Likewise.

	* gimple-ssa-isolate-paths.c (isolate_path): Strengthen local
	"ret" from gimple to gimple_return.
	(find_implicit_erroneous_behaviour): Replace a check for code
	GIMPLE_RETURN with a dyn_cast and a new local.
	(find_explicit_erroneous_behaviour): Likewise.
	* gimple-walk.c (walk_stmt_load_store_addr_ops): Likewise.
	* gimple.c (infer_nonnull_range): Likewise.
	* ipa-split.c (find_return_bb): Likewise.
	(find_retval): Likewise.
	(split_function): Likewise.
	* omp-low.c (ipa_simd_modify_function_body): Likewise.
	* tree-cfg.c (pass_warn_function_return::execute): Likewise.
	* tree-nrv.c (tree_nrv): Likewise.
	* tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Likewise.
	* tree-ssa-dce.c (propagate_necessity): Likewise.
	* tree-ssa-structalias.c (find_func_clobbers): Likewise.
	* tree-tailcall.c (find_tail_calls): Likewise.

	* predict.c (apply_return_prediction): Rework the search for
	return_stmt so that the latter can have type gimple_return.
---
 gcc/ChangeLog.gimple-classes   | 41 +++++++++++++++++++++++++++++++++++++++++
 gcc/cfgexpand.c                |  4 ++--
 gcc/gimple-ssa-isolate-paths.c | 16 ++++++++++------
 gcc/gimple-walk.c              |  4 ++--
 gcc/gimple.c                   | 14 +++++++-------
 gcc/gimple.h                   |  9 +++------
 gcc/ipa-split.c                | 13 +++++++------
 gcc/omp-low.c                  |  4 ++--
 gcc/predict.c                  | 13 ++++++++-----
 gcc/tree-cfg.c                 |  5 +++--
 gcc/tree-complex.c             |  9 ++++++---
 gcc/tree-inline.c              |  2 +-
 gcc/tree-nrv.c                 |  4 ++--
 gcc/tree-sra.c                 |  6 +++---
 gcc/tree-ssa-alias.c           |  4 ++--
 gcc/tree-ssa-dce.c             |  4 ++--
 gcc/tree-ssa-structalias.c     | 12 +++++++-----
 gcc/tree-tailcall.c            |  2 +-
 gcc/ubsan.c                    |  2 +-
 19 files changed, 110 insertions(+), 58 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index f2f9a05..c024a2b 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,46 @@
 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
 
+	Concretize three gimple_return_ accessors
+
+	* gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
+	rather than a const_gimple.
+	(gimple_return_retval): Likewise.
+	(gimple_return_set_retval): Require a gimple_return.
+
+	* cfgexpand.c (expand_gimple_stmt_1): Add a checked cast to
+	gimple_return.
+	(expand_gimple_basic_block): Likewise.
+	* tree-complex.c (expand_complex_move): Likewise.
+	(expand_complex_comparison): Likewise.
+	* tree-inline.c (remap_gimple_stmt): Likewise.
+	* tree-sra.c (scan_function): Likewise.
+	(sra_modify_function_body): Likewise.
+	(ipa_sra_modify_function_body): Likewise.
+	* tree-ssa-structalias.c (find_func_aliases): Likewise.
+
+	* gimple-ssa-isolate-paths.c (isolate_path): Strengthen local
+	"ret" from gimple to gimple_return.
+	(find_implicit_erroneous_behaviour): Replace a check for code
+	GIMPLE_RETURN with a dyn_cast and a new local.
+	(find_explicit_erroneous_behaviour): Likewise.
+	* gimple-walk.c (walk_stmt_load_store_addr_ops): Likewise.
+	* gimple.c (infer_nonnull_range): Likewise.
+	* ipa-split.c (find_return_bb): Likewise.
+	(find_retval): Likewise.
+	(split_function): Likewise.
+	* omp-low.c (ipa_simd_modify_function_body): Likewise.
+	* tree-cfg.c (pass_warn_function_return::execute): Likewise.
+	* tree-nrv.c (tree_nrv): Likewise.
+	* tree-ssa-alias.c (ref_maybe_used_by_stmt_p): Likewise.
+	* tree-ssa-dce.c (propagate_necessity): Likewise.
+	* tree-ssa-structalias.c (find_func_clobbers): Likewise.
+	* tree-tailcall.c (find_tail_calls): Likewise.
+
+	* predict.c (apply_return_prediction): Rework the search for
+	return_stmt so that the latter can have type gimple_return.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Make gimple_phi_arg_location require a gimple_phi.
 
 	* gimple.h (gimple_phi_arg_location): Require a gimple_phi.
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 4287232..0715b83 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3220,7 +3220,7 @@ expand_gimple_stmt_1 (gimple stmt)
       break;
 
     case GIMPLE_RETURN:
-      op0 = gimple_return_retval (stmt);
+      op0 = gimple_return_retval (as_a <gimple_return> (stmt));
 
       if (op0 && op0 != error_mark_node)
 	{
@@ -4915,7 +4915,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls)
   if (!gsi_end_p (gsi)
       && gimple_code (gsi_stmt (gsi)) == GIMPLE_RETURN)
     {
-      gimple ret_stmt = gsi_stmt (gsi);
+      gimple_return ret_stmt = as_a <gimple_return> (gsi_stmt (gsi));
 
       gcc_assert (single_succ_p (bb));
       gcc_assert (single_succ (bb) == EXIT_BLOCK_PTR_FOR_FN (cfun));
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 528b3eb..49c9086 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -205,7 +205,7 @@ isolate_path (basic_block bb, basic_block duplicate,
     {
       if (ret_zero)
 	{
-	  gimple ret = gsi_stmt (si2);
+	  gimple_return ret = as_a <gimple_return> (gsi_stmt (si2));
 	  tree zero = build_zero_cst (TREE_TYPE (gimple_return_retval (ret)));
 	  gimple_return_set_retval (ret, zero);
 	  update_stmt (ret);
@@ -285,8 +285,12 @@ find_implicit_erroneous_behaviour (void)
 		    {
 		      FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
 			{
-			  if (gimple_code (use_stmt) != GIMPLE_RETURN
-			      || gimple_return_retval (use_stmt) != lhs)
+			  gimple_return return_stmt =
+			    dyn_cast <gimple_return> (use_stmt);
+			  if (!return_stmt)
+			    continue;
+
+			  if (gimple_return_retval (return_stmt) != lhs)
 			    continue;
 
 			  if (warning_at (gimple_location (use_stmt),
@@ -399,9 +403,9 @@ find_explicit_erroneous_behaviour (void)
 	  /* Detect returning the address of a local variable.  This only
 	     becomes undefined behavior if the result is used, so we do not
 	     insert a trap and only return NULL instead.  */
-	  if (gimple_code (stmt) == GIMPLE_RETURN)
+	  if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
 	    {
-	      tree val = gimple_return_retval (stmt);
+	      tree val = gimple_return_retval (return_stmt);
 	      if (val && TREE_CODE (val) == ADDR_EXPR)
 		{
 		  tree valbase = get_base_address (TREE_OPERAND (val, 0));
@@ -425,7 +429,7 @@ find_explicit_erroneous_behaviour (void)
 				      OPT_Wreturn_local_addr, msg))
 			inform (DECL_SOURCE_LOCATION(valbase), "declared here");
 		      tree zero = build_zero_cst (TREE_TYPE (val));
-		      gimple_return_set_retval (stmt, zero);
+		      gimple_return_set_retval (return_stmt, zero);
 		      update_stmt (stmt);
 		    }
 		}
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index bbc5963..57aa780 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -852,9 +852,9 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
 	      }
 	  }
     }
-  else if (gimple_code (stmt) == GIMPLE_RETURN)
+  else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
     {
-      tree op = gimple_return_retval (stmt);
+      tree op = gimple_return_retval (return_stmt);
       if (op)
 	{
 	  if (visit_addr
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 0fac6b4..a244617 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2653,13 +2653,13 @@ infer_nonnull_range (gimple stmt, tree op, bool dereference, bool attribute)
 
   /* If this function is marked as returning non-null, then we can
      infer OP is non-null if it is used in the return statement.  */
-  if (attribute
-      && gimple_code (stmt) == GIMPLE_RETURN
-      && gimple_return_retval (stmt)
-      && operand_equal_p (gimple_return_retval (stmt), op, 0)
-      && lookup_attribute ("returns_nonnull",
-			   TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
-    return true;
+  if (attribute)
+    if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
+      if (gimple_return_retval (return_stmt)
+	  && operand_equal_p (gimple_return_retval (return_stmt), op, 0)
+	  && lookup_attribute ("returns_nonnull",
+			       TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))))
+	return true;
 
   return false;
 }
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 688c375..e1afe99 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -5513,18 +5513,16 @@ gimple_transaction_set_subcode (gimple_transaction transaction_stmt,
 /* Return a pointer to the return value for GIMPLE_RETURN GS.  */
 
 static inline tree *
-gimple_return_retval_ptr (const_gimple gs)
+gimple_return_retval_ptr (const_gimple_return gs)
 {
-  GIMPLE_CHECK (gs, GIMPLE_RETURN);
   return gimple_op_ptr (gs, 0);
 }
 
 /* Return the return value for GIMPLE_RETURN GS.  */
 
 static inline tree
-gimple_return_retval (const_gimple gs)
+gimple_return_retval (const_gimple_return gs)
 {
-  GIMPLE_CHECK (gs, GIMPLE_RETURN);
   return gimple_op (gs, 0);
 }
 
@@ -5532,9 +5530,8 @@ gimple_return_retval (const_gimple gs)
 /* Set RETVAL to be the return value for GIMPLE_RETURN GS.  */
 
 static inline void
-gimple_return_set_retval (gimple gs, tree retval)
+gimple_return_set_retval (gimple_return gs, tree retval)
 {
-  GIMPLE_CHECK (gs, GIMPLE_RETURN);
   gimple_set_op (gs, 0, retval);
 }
 
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 59901dc..e5df578 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -710,10 +710,10 @@ find_return_bb (void)
 		   || is_gimple_min_invariant (gimple_assign_rhs1 (stmt)))
 	       && retval == gimple_assign_lhs (stmt))
 	;
-      else if (gimple_code (stmt) == GIMPLE_RETURN)
+      else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
 	{
 	  found_return = true;
-	  retval = gimple_return_retval (stmt);
+	  retval = gimple_return_retval (return_stmt);
 	}
       else
 	break;
@@ -731,8 +731,8 @@ find_retval (basic_block return_bb)
 {
   gimple_stmt_iterator bsi;
   for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
-    if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
-      return gimple_return_retval (gsi_stmt (bsi));
+    if (gimple_return return_stmt = dyn_cast <gimple_return> (gsi_stmt (bsi)))
+      return gimple_return_retval (return_stmt);
     else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
 	     && !gimple_clobber_p (gsi_stmt (bsi)))
       return gimple_assign_rhs1 (gsi_stmt (bsi));
@@ -1446,9 +1446,10 @@ split_function (struct split_point *split_point)
 		      gimple_stmt_iterator bsi;
 		      for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi);
 			   gsi_next (&bsi))
-			if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
+			if (gimple_return return_stmt =
+			      dyn_cast <gimple_return> (gsi_stmt (bsi)))
 			  {
-			    gimple_return_set_retval (gsi_stmt (bsi), retval);
+			    gimple_return_set_retval (return_stmt, retval);
 			    break;
 			  }
 			else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6174c3f..1e1ee1d 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -11951,9 +11951,9 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
 	  wi.info = &info;
 	  walk_gimple_op (stmt, ipa_simd_modify_stmt_ops, &wi);
 
-	  if (gimple_code (stmt) == GIMPLE_RETURN)
+	  if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
 	    {
-	      tree retval = gimple_return_retval (stmt);
+	      tree retval = gimple_return_retval (return_stmt);
 	      if (!retval)
 		{
 		  gsi_remove (&gsi, true);
diff --git a/gcc/predict.c b/gcc/predict.c
index 5e8a0e9..c21cc29 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2145,7 +2145,7 @@ return_prediction (tree val, enum prediction *prediction)
 static void
 apply_return_prediction (void)
 {
-  gimple return_stmt = NULL;
+  gimple_return return_stmt = NULL;
   tree return_val;
   edge e;
   gimple_phi phi;
@@ -2156,10 +2156,13 @@ apply_return_prediction (void)
 
   FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
     {
-      return_stmt = last_stmt (e->src);
-      if (return_stmt
-	  && gimple_code (return_stmt) == GIMPLE_RETURN)
-	break;
+      gimple last = last_stmt (e->src);
+      if (last
+	  && gimple_code (last) == GIMPLE_RETURN)
+	{
+	  return_stmt = as_a <gimple_return> (last);
+	  break;
+	}
     }
   if (!e)
     return;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b0d94ee..4aaeb6d 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8335,8 +8335,9 @@ pass_warn_function_return::execute (function *fun)
       FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds)
 	{
 	  gimple last = last_stmt (e->src);
-	  if (gimple_code (last) == GIMPLE_RETURN
-	      && gimple_return_retval (last) == NULL
+	  gimple_return return_stmt = dyn_cast <gimple_return> (last);
+	  if (return_stmt
+	      && gimple_return_retval (return_stmt) == NULL
 	      && !gimple_no_warning_p (last))
 	    {
 	      location = gimple_location (last);
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index d2b4f01..a7cbceb 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -855,7 +855,7 @@ expand_complex_move (gimple_stmt_iterator *gsi, tree type)
 
 	  stmt = gsi_stmt (*gsi);
 	  gcc_assert (gimple_code (stmt) == GIMPLE_RETURN);
-	  gimple_return_set_retval (stmt, lhs);
+	  gimple_return_set_retval (as_a <gimple_return> (stmt), lhs);
 	}
 
       update_stmt (stmt);
@@ -1391,8 +1391,11 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
   switch (gimple_code (stmt))
     {
     case GIMPLE_RETURN:
-      type = TREE_TYPE (gimple_return_retval (stmt));
-      gimple_return_set_retval (stmt, fold_convert (type, cc));
+      {
+	gimple_return return_stmt = as_a <gimple_return> (stmt);
+	type = TREE_TYPE (gimple_return_retval (return_stmt));
+	gimple_return_set_retval (return_stmt, fold_convert (type, cc));
+      }
       break;
 
     case GIMPLE_ASSIGN:
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 945614a..11446d7 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1302,7 +1302,7 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
      statement.  */
   if (gimple_code (stmt) == GIMPLE_RETURN && id->transform_return_to_modify)
     {
-      tree retval = gimple_return_retval (stmt);
+      tree retval = gimple_return_retval (as_a <gimple_return> (stmt));
 
       /* If we're returning something, just turn that into an
 	 assignment into the equivalent of the original RESULT_DECL.
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 91a9531..cc16aa2 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -180,12 +180,12 @@ pass_nrv::execute (function *fun)
 	  gimple stmt = gsi_stmt (gsi);
 	  tree ret_val;
 
-	  if (gimple_code (stmt) == GIMPLE_RETURN)
+	  if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
 	    {
 	      /* In a function with an aggregate return value, the
 		 gimplifier has changed all non-empty RETURN_EXPRs to
 		 return the RESULT_DECL.  */
-	      ret_val = gimple_return_retval (stmt);
+	      ret_val = gimple_return_retval (return_stmt);
 	      if (ret_val)
 		gcc_assert (ret_val == result);
 	    }
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 9f67f6d..50464f1 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1280,7 +1280,7 @@ scan_function (void)
 	  switch (gimple_code (stmt))
 	    {
 	    case GIMPLE_RETURN:
-	      t = gimple_return_retval (stmt);
+	      t = gimple_return_retval (as_a <gimple_return> (stmt));
 	      if (t != NULL_TREE)
 		ret |= build_access_from_expr (t, stmt, false);
 	      if (final_bbs)
@@ -3389,7 +3389,7 @@ sra_modify_function_body (void)
 	  switch (gimple_code (stmt))
 	    {
 	    case GIMPLE_RETURN:
-	      t = gimple_return_retval_ptr (stmt);
+	      t = gimple_return_retval_ptr (as_a <gimple_return> (stmt));
 	      if (*t != NULL_TREE)
 		modified |= sra_modify_expr (t, &gsi, false);
 	      break;
@@ -4652,7 +4652,7 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments)
 	  switch (gimple_code (stmt))
 	    {
 	    case GIMPLE_RETURN:
-	      t = gimple_return_retval_ptr (stmt);
+	      t = gimple_return_retval_ptr (as_a <gimple_return> (stmt));
 	      if (*t != NULL_TREE)
 		modified |= ipa_modify_expr (t, true, adjustments);
 	      break;
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 611b16f..07ecbd1 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1826,9 +1826,9 @@ ref_maybe_used_by_stmt_p (gimple stmt, ao_ref *ref)
     }
   else if (is_gimple_call (stmt))
     return ref_maybe_used_by_call_p (as_a <gimple_call> (stmt), ref);
-  else if (gimple_code (stmt) == GIMPLE_RETURN)
+  else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
     {
-      tree retval = gimple_return_retval (stmt);
+      tree retval = gimple_return_retval (return_stmt);
       if (retval
 	  && TREE_CODE (retval) != SSA_NAME
 	  && !is_gimple_min_invariant (retval)
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index f853512..aba2d98 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -868,9 +868,9 @@ propagate_necessity (bool aggressive)
 		    mark_all_reaching_defs_necessary (stmt);
 		}
 	    }
-	  else if (gimple_code (stmt) == GIMPLE_RETURN)
+	  else if (gimple_return return_stmt = dyn_cast <gimple_return> (stmt))
 	    {
-	      tree rhs = gimple_return_retval (stmt);
+	      tree rhs = gimple_return_retval (return_stmt);
 	      /* A return statement may perform a load.  */
 	      if (rhs
 		  && TREE_CODE (rhs) != SSA_NAME
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index a130268..550bfb4 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4732,12 +4732,13 @@ find_func_aliases (struct function *fn, gimple origt)
     }
   /* Handle escapes through return.  */
   else if (gimple_code (t) == GIMPLE_RETURN
-	   && gimple_return_retval (t) != NULL_TREE)
+	   && gimple_return_retval (as_a <gimple_return> (t)) != NULL_TREE)
     {
+      gimple_return return_stmt = as_a <gimple_return> (t);
       fi = NULL;
       if (!in_ipa_mode
 	  || !(fi = get_vi_for_tree (fn->decl)))
-	make_escape_constraint (gimple_return_retval (t));
+	make_escape_constraint (gimple_return_retval (return_stmt));
       else if (in_ipa_mode
 	       && fi != NULL)
 	{
@@ -4746,7 +4747,7 @@ find_func_aliases (struct function *fn, gimple origt)
 	  unsigned i;
 
 	  lhs = get_function_part_constraint (fi, fi_result);
-	  get_constraint_for_rhs (gimple_return_retval (t), &rhsc);
+	  get_constraint_for_rhs (gimple_return_retval (return_stmt), &rhsc);
 	  FOR_EACH_VEC_ELT (rhsc, i, rhsp)
 	    process_constraint (new_constraint (lhs, *rhsp));
 	}
@@ -4885,10 +4886,11 @@ find_func_clobbers (struct function *fn, gimple origt)
   /* Account for uses in assigments and returns.  */
   if (gimple_assign_single_p (t)
       || (gimple_code (t) == GIMPLE_RETURN
-	  && gimple_return_retval (t) != NULL_TREE))
+	  && gimple_return_retval (as_a <gimple_return> (t)) != NULL_TREE))
     {
       tree rhs = (gimple_assign_single_p (t)
-		  ? gimple_assign_rhs1 (t) : gimple_return_retval (t));
+		  ? gimple_assign_rhs1 (t)
+		  : gimple_return_retval (as_a <gimple_return> (t)));
       tree tem = rhs;
       while (handled_component_p (tem))
 	tem = TREE_OPERAND (tem, 0);
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 5a1763c..9bf3c42 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -586,7 +586,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
     }
 
   /* See if this is a tail call we can handle.  */
-  ret_var = gimple_return_retval (stmt);
+  ret_var = gimple_return_retval (as_a <gimple_return> (stmt));
 
   /* We may proceed if there either is no return value, or the return value
      is identical to the call's return.  */
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index bc4f501..78320d5 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -1364,7 +1364,7 @@ instrument_nonnull_arg (gimple_stmt_iterator *gsi)
 static void
 instrument_nonnull_return (gimple_stmt_iterator *gsi)
 {
-  gimple stmt = gsi_stmt (*gsi);
+  gimple_return stmt = as_a <gimple_return> (gsi_stmt (*gsi));
   location_t loc[2];
   tree arg = gimple_return_retval (stmt);
   /* infer_nonnull_range needs flag_delete_null_pointer_checks set,
-- 
1.8.5.3

  parent reply	other threads:[~2014-10-27 20:36 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 20:35 [gimple-classes, committed 00/92] Initial slew of commits David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 27/92] Introduce gimple_resx David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 20/92] Introduce gimple_goto David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 22/92] Introduce gimple_transaction David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 19/92] Introduce gimple_return David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 03/92] Introduce gimple_cond and use it in various places David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 45/92] omp-low.c: Use more concrete types of gimple statement for various locals David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 14/92] tree-ssa-loop-manip.c: use gimple_phi in three places David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 06/92] Introduce gimple_debug and use it in a few places David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 33/92] Introduce gimple_omp_atomic_store David Malcolm
2014-10-27 20:35 ` [gimple-classes, committed 38/92] tree-cfg.c: Make verify_gimple_call require a gimple_call David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 43/92] Introduce gimple_omp_sections David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 04/92] Introduce gimple_assign and use it in various places David Malcolm
2014-10-27 20:36 ` David Malcolm [this message]
2014-10-27 20:36 ` [gimple-classes, committed 01/92] Introduce gimple_switch " David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 69/92] Concretize gimple_cond_make_{false|true} David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 39/92] Introduce gimple_omp_task David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 61/92] Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 87/92] Convert various gimple to gimple_phi within ssa-iterators.h David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 82/92] Concretize gimple_call_arg_flags David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 25/92] Introduce gimple_eh_must_not_throw David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 71/92] Concretize gimple_cond_{true|false}_label David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 57/92] Make gimple_goto_set_dest require a gimple_goto David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 05/92] Introduce gimple_label and use it in a few places David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 70/92] Concretize gimple_switch_index and gimple_switch_index_ptr David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 92/92] Update gimple.texi class hierarchy diagram David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 40/92] Introduce gimple_omp_single David Malcolm
2014-10-27 20:36 ` [gimple-classes, committed 51/92] More gimple_phi David Malcolm
2014-10-27 20:37 ` [gimple-classes, committed 83/92] Concretize gimple_assign_nontemporal_move_p David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 86/92] Use gimple_phi in many more places David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 63/92] Concretize three gimple_try_set_ accessors David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 77/92] Concretize gimple_call_nothrow_p David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 74/92] Concretize gimple_cond_{lhs|rhs}_ptr David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 88/92] Preparatory work before subclass renaming David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 02/92] Introduce gimple_bind and use it for accessors David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 73/92] Concretize gimple_cond_set_{lhs|rhs} David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 80/92] Concretize gimple_call_set_fntype David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 75/92] Concretize various expressions from gimple to gimple_cond David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 54/92] Various gimple to gimple_call conversions in IPA David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 49/92] Update GRAPHITE to use more concrete gimple statement classes David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 90/92] Automated renaming of gimple subclasses David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 68/92] Concretize locals within expand_omp_for_init_counts David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 31/92] Use more concrete types for various gimple statements David Malcolm
2014-10-27 20:38 ` [gimple-classes, committed 72/92] Concretize gimple_cond_set_code David Malcolm
2014-10-27 20:40 ` [gimple-classes, committed 09/92] Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi David Malcolm
2014-10-27 20:47 ` [gimple-classes, committed 89/92] Eliminate subclass typedefs from coretypes.h David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 64/92] Make gimple_phi_arg_location_from_edge require a gimple_phi David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 78/92] Tweak to gimplify_modify_expr David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 15/92] tree-ssa-loop-ivopts.c: use gimple_phi in a few places David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 28/92] Introduce gimple_eh_dispatch David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 10/92] tree-parloops.c: use gimple_phi in various places David Malcolm
2014-10-27 20:52 ` [gimple-classes, committed 37/92] Introduce gimple_omp_parallel David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 13/92] tree-ssa-loop-niter.c: use gimple_phi in a few places David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 23/92] Introduce gimple_catch David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 58/92] Concretize gimple_catch_types David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 35/92] Introduce gimple_omp_critical David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 60/92] Concretize gimple_label_label David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 42/92] Introduce gimple_omp_teams David Malcolm
2014-10-27 20:53 ` [gimple-classes, committed 34/92] Introduce gimple_omp_continue David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 56/92] Make gimple_label_set_label require a gimple_label David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 12/92] tree-ssa-phiprop.c: use gimple_phi David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 11/92] tree-predcom.c: use gimple_phi in various places David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 47/92] Make add_phi_arg require a gimple_phi David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 21/92] Introduce gimple_asm David Malcolm
2014-10-27 20:54 ` [gimple-classes, committed 79/92] Concretize gimple_call_set_fn David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 46/92] Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a gimple_phi David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 41/92] Introduce gimple_omp_target David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 44/92] tree-parloops.c: Use gimple_phi in various places David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 59/92] Concretize gimple_call_use_set and gimple_call_clobber_set David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 36/92] Introduce gimple_omp_for David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 18/92] Introduce gimple_call David Malcolm
2014-10-27 20:55 ` [gimple-classes, committed 48/92] Make gimple_phi_arg_set_location require a gimple_phi David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 52/92] Make gimple_call_return_slot_opt_p require a gimple_call David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 81/92] Concretize gimple_call_set_tail and gimple_call_tail_p David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 76/92] Concretize gimple_call_set_nothrow David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 07/92] Introduce gimple_phi and use it in various places David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 62/92] Concretize gimple_try_set_catch_is_cleanup David Malcolm
2014-10-27 20:56 ` [gimple-classes, committed 30/92] Introduce gimple_try David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 24/92] Introduce gimple_eh_filter David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 53/92] Use gimple_call for callgraph edges David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 50/92] Make gimple_phi_arg_edge require a gimple_phi David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 91/92] Remove out-of-date references to typedefs David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 65/92] Make gimple_phi_arg_location require a gimple_phi David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 26/92] Introduce gimple_eh_else David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 08/92] Introduce gimple_phi_iterator David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 32/92] Introduce gimple_omp_atomic_load David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 29/92] Use subclasses of gimple in various places David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 17/92] Concretize get_loop_exit_condition et al to working on gimple_cond David Malcolm
2014-10-27 20:57 ` [gimple-classes, committed 16/92] Update various expressions within tree-scalar-evolution.c to be gimple_phi David Malcolm
2014-10-27 21:32 ` [gimple-classes, committed 55/92] Concretize parameter to gimple_call_copy_skip_args David Malcolm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414442490-14841-67-git-send-email-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).