public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-141] tree-optimization/100278 - handle mismatched code in TBAA adjust of PRE
@ 2021-04-27 8:30 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-04-27 8:30 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:acfe5290406cc70485df8899d14982278a9371f8
commit r12-141-gacfe5290406cc70485df8899d14982278a9371f8
Author: Richard Biener <rguenther@suse.de>
Date: Tue Apr 27 09:41:38 2021 +0200
tree-optimization/100278 - handle mismatched code in TBAA adjust of PRE
PRE has code to adjust TBAA behavior for refs that expects the base
operation code to match. The testcase shows a case where we have
a VAR_DECL vs. a MEM_REF so add code to give up in such cases.
2021-04-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/100278
* tree-ssa-pre.c (compute_avail): Give up when we cannot
adjust TBAA beacuse of mismatching bases.
* gcc.dg/tree-ssa/pr100278.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/tree-ssa/pr100278.c | 17 +++++++++++++++++
gcc/tree-ssa-pre.c | 10 ++++++++++
2 files changed, 27 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c
new file mode 100644
index 00000000000..8d702284c3a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr100278.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void a()
+{
+#if defined __s390__
+ register int b asm("r5");
+#elif defined __x86_64__
+ register int b asm("eax");
+#else
+ volatile int b;
+#endif
+ if (b)
+ b = 1;
+ for (; b;)
+ ;
+}
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 2803b58430e..2d22535af87 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4151,6 +4151,16 @@ compute_avail (void)
if (ref->set == set
|| alias_set_subset_of (set, ref->set))
;
+ else if (ref1->opcode != ref2->opcode
+ || (ref1->opcode != MEM_REF
+ && ref1->opcode != TARGET_MEM_REF))
+ {
+ /* With mismatching base opcodes or bases
+ other than MEM_REF or TARGET_MEM_REF we
+ can't do any easy TBAA adjustment. */
+ operands.release ();
+ continue;
+ }
else if (alias_set_subset_of (ref->set, set))
{
ref->set = set;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-27 8:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 8:30 [gcc r12-141] tree-optimization/100278 - handle mismatched code in TBAA adjust of PRE 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).