public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 11/12] ipa-sra: Make scan_expr_access bail out on uninteresting expressions
@ 2022-11-12  1:47 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2022-11-12  1:47 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka, Jan Hubicka

Hi,

I have noticed that scan_expr_access passes all the expressions it
gets to get_ref_base_and_extent even when we are really only
interested in memory accesses.  So bail out when the expression is
something clearly uninteresting.

Bootstrapped and tested on x86_64-linux.  OK for master?

Thanks,

Martin


gcc/ChangeLog:

2021-12-14  Martin Jambor  <mjambor@suse.cz>

	* ipa-sra.c (scan_expr_access): Bail out early if expr is something we
	clearly do not need to pass to get_ref_base_and_extent.
---
 gcc/ipa-sra.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 93fceeafc73..3646d71468c 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -1748,6 +1748,11 @@ scan_expr_access (tree expr, gimple *stmt, isra_scan_context ctx,
       || TREE_CODE (expr) == REALPART_EXPR)
     expr = TREE_OPERAND (expr, 0);
 
+  if (!handled_component_p (expr)
+      && !DECL_P (expr)
+      && TREE_CODE (expr) != MEM_REF)
+    return;
+
   base = get_ref_base_and_extent (expr, &poffset, &psize, &pmax_size, &reverse);
 
   if (TREE_CODE (base) == MEM_REF)
-- 
2.38.0


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

only message in thread, other threads:[~2022-11-12  1:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-12  1:47 [PATCH 11/12] ipa-sra: Make scan_expr_access bail out on uninteresting expressions Martin Jambor

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