Hi Andrea

> -----Original Message-----
> From: Gcc-patches <gcc-patches-boun...@gcc.gnu.org> On Behalf Of Andrea
> Corallo
> Sent: 08 April 2020 15:19
> To: gcc-patches@gcc.gnu.org
> Cc: nd <n...@arm.com>
> Subject: [PATCH] PR target/48240
> 
> Hi all,
> 
> I'd like to submit this for PR48240.
> 
> Bootstrapped on aarch64-unknown-linux-gnu.
> Okay for trunk when finished with regression?
> 
> Andrea
> 
> gcc/ChangeLog
> 
> 2020-??-??  Andrea Corallo  <andrea.cora...@arm.com>
> 
>       PR target/48240
>       * gcc/config/aarch64/falkor-tag-collision-avoidance.c
>       (valid_src_p): Fix missing rtx type check.
> 
> gcc/testsuite/ChangeLog
> 
> 2020-??-??  Andrea Corallo  <andrea.cora...@arm.com>
> 
>       * gcc.target/aarch64/pr48240.c: New test.

>From 246337341a8b58c61dc29d2198b244da737b3ef0 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.cora...@arm.com>
Date: Wed, 8 Apr 2020 13:38:28 +0100
Subject: [PATCH] pr48240

---
 gcc/config/aarch64/falkor-tag-collision-avoidance.c | 9 ++++++---
 gcc/testsuite/gcc.target/aarch64/pr48240.c          | 9 +++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr48240.c

diff --git a/gcc/config/aarch64/falkor-tag-collision-avoidance.c 
b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
index 719df484ee61..4e07a43282f7 100644
--- a/gcc/config/aarch64/falkor-tag-collision-avoidance.c
+++ b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
@@ -538,9 +538,12 @@ valid_src_p (rtx src, rtx_insn *insn, struct loop *loop, 
bool *pre_post,
   if (!aarch64_classify_address (&addr, XEXP (x, 0), mode, true))
     return false;
 
-  unsigned regno = REGNO (addr.base);
-  if (global_regs[regno] || fixed_regs[regno])
-    return false;
+  if (REG_P (addr.base))
+    {
+      unsigned regno = REGNO (addr.base);
+      if (global_regs[regno] || fixed_regs[regno])
+       return false;
+    }

I think we want to just return false here if !REG_P (addr.base) rather than 
fall through?

 
   if (addr.type == ADDRESS_REG_WB)
     {
diff --git a/gcc/testsuite/gcc.target/aarch64/pr48240.c 
b/gcc/testsuite/gcc.target/aarch64/pr48240.c
new file mode 100644
index 000000000000..012af6afeca7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr48240.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-v -Os -mcpu=falkor -mpc-relative-literal-loads 
-mcmodel=large" } */

We shouldn't need the "-v" here...

Ok with those changes.
Thanks,
Kyrill

+
+extern void bar(const char *);
+
+void foo(void) {
+  for (;;)
+    bar("");
+}
-- 
2.17.1

Reply via email to