public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Assume a call is expensive when it mismatches
@ 2022-05-02 12:58 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-05-02 12:58 UTC (permalink / raw)
  To: gcc-patches

This makes sure to not consider calls to builtin decls with
mismatching arguments as inexpensive.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2022-04-13  Richard Biener  <rguenther@suse.de>

	* tree-scalar-evolution.cc (expression_expensive_p):
	Never consider mismatched calls as cheap.
---
 gcc/tree-scalar-evolution.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc
index 44157265ce8..b53d7aaa71d 100644
--- a/gcc/tree-scalar-evolution.cc
+++ b/gcc/tree-scalar-evolution.cc
@@ -3420,12 +3420,15 @@ expression_expensive_p (tree expr, hash_map<tree, uint64_t> &cache,
 		  break;
 	      return true;
 	    }
+	  break;
+
 	default:
+	  if (cfn == CFN_LAST
+	      || !is_inexpensive_builtin (get_callee_fndecl (expr)))
+	    return true;
 	  break;
 	}
 
-      if (!is_inexpensive_builtin (get_callee_fndecl (expr)))
-	return true;
       FOR_EACH_CALL_EXPR_ARG (arg, iter, expr)
 	if (expression_expensive_p (arg, cache, op_cost))
 	  return true;
-- 
2.34.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-02 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02 12:58 [PATCH] Assume a call is expensive when it mismatches Richard Biener

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).