From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/113602 - datarefs of non-addressables
Date: Fri, 26 Jan 2024 11:22:58 +0100 (CET) [thread overview]
Message-ID: <20240126102300.2442113A22@imap1.dmz-prg2.suse.org> (raw)
We can end up creating ADDR_EXPRs of non-addressable entities during
for example vectorization. The following plugs this in data-ref
analysis when that would create such invalid ADDR_EXPR as part of
analyzing the ref structure.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/113602
* tree-vect-data-ref.cc (dr_analyze_innermost): Fail when
the base object isn't addressable.
* gcc.dg/pr113602.c: New testcase.
---
gcc/testsuite/gcc.dg/pr113602.c | 10 ++++++++++
gcc/tree-data-ref.cc | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/pr113602.c
diff --git a/gcc/testsuite/gcc.dg/pr113602.c b/gcc/testsuite/gcc.dg/pr113602.c
new file mode 100644
index 00000000000..94bfbc91b5f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr113602.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target bitint575 } */
+/* { dg-options "-O2 -fno-tree-loop-optimize" } */
+
+_BitInt(503)
+f(void)
+{
+ register _BitInt(503) r asm(""); /* { dg-error "invalid" } */
+ return r;
+}
diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc
index ae55bf6aa48..f37734b5340 100644
--- a/gcc/tree-data-ref.cc
+++ b/gcc/tree-data-ref.cc
@@ -1182,7 +1182,12 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref,
base = TREE_OPERAND (base, 0);
}
else
- base = build_fold_addr_expr (base);
+ {
+ if (may_be_nonaddressable_p (base))
+ return opt_result::failure_at (stmt,
+ "failed: base not addressable.\n");
+ base = build_fold_addr_expr (base);
+ }
if (in_loop)
{
--
2.35.3
reply other threads:[~2024-01-26 10:23 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=20240126102300.2442113A22@imap1.dmz-prg2.suse.org \
--to=rguenther@suse.de \
--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).