public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-72] Assume a call is expensive when it mismatches
Date: Mon,  2 May 2022 12:59:03 +0000 (GMT)	[thread overview]
Message-ID: <20220502125903.CECC03857815@sourceware.org> (raw)

https://gcc.gnu.org/g:1cb220498e1f59021dab36c39c5d726e9f070c6a

commit r13-72-g1cb220498e1f59021dab36c39c5d726e9f070c6a
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Apr 13 15:43:01 2022 +0200

    Assume a call is expensive when it mismatches
    
    This makes sure to not consider calls to builtin decls with
    mismatching arguments as inexpensive.
    
    2022-04-13  Richard Biener  <rguenther@suse.de>
    
            * tree-scalar-evolution.cc (expression_expensive_p):
            Never consider mismatched calls as cheap.

Diff:
---
 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;


                 reply	other threads:[~2022-05-02 12:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220502125903.CECC03857815@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@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).