From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Richard Biener <rguenther@suse.de>, Jeff Law <law@redhat.com>,
Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH] Fix PR 91708
Date: Tue, 10 Sep 2019 19:51:00 -0000 [thread overview]
Message-ID: <AM6PR10MB2566D9B47A2676B890457CB3E4B60@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM> (raw)
[-- Attachment #1: Type: text/plain, Size: 2147 bytes --]
Hi!
This ICE happens when compiling real_nextafter in real.c.
CSE sees this:
(insn 179 178 180 11 (set (reg:SI 319)
(reg/v/f:SI 273 [ rD.73757 ])) "../../gcc-trunk-1/gcc/real.c":120:10 643 {*thumb2_movsi_vfp}
(nil))
[...]
(insn 181 180 182 11 (set (mem:SI (reg:SI 319) [0 MEM <charD.7[1:24]> [(voidD.73 *)r_77(D)]+0 S4 A8])
(unspec:SI [
(reg:SI 320)
] UNSPEC_UNALIGNED_STORE)) "../../gcc-trunk-1/gcc/real.c":120:10 129 {unaligned_storesi}
(nil))
[...]
(insn 186 185 187 11 (set (mem:SI (plus:SI (reg/v/f:SI 273 [ rD.73757 ])
(const_int 20 [0x14])) [0 MEM <charD.7[1:24]> [(voidD.73 *)r_77(D)]+20 S4 A8])
(unspec:SI [
(reg:SI 320)
] UNSPEC_UNALIGNED_STORE)) "../../gcc-trunk-1/gcc/real.c":120:10 129 {unaligned_storesi}
(expr_list:REG_DEAD (reg:SI 320)
(expr_list:REG_DEAD (reg/f:SI 319 [ rD.73757 ])
(nil))))
[...]
(insn 234 233 235 11 (set (reg:SI 340)
(mem:SI (reg/v/f:SI 273 [ rD.73757 ]) [52 MEM <unsigned int> [(struct real_valueD.28367 *)r_77(D)]+0 S4 A32])) "../../gcc-trunk-1/gcc/real.c":5185:9 643 {*thumb2_movsi_vfp}
(nil))
... and transforms insn 234 in an invalid insn:
(insn 234 233 235 11 (set (reg:SI 340 [ MEM <unsigned int> [(struct real_valueD.28367 *)r_77(D)] ])
(mem:SI (plus:SI (reg/v/f:SI 273 [ rD.73757 ])
(const_int 20 [0x14])) [0 MEM <charD.7[1:24]> [(voidD.73 *)r_77(D)]+20 S4 A8])) "../../gcc-trunk-1/gcc/real.c":5185:9 643 {*thumb2_movsi_vfp}
(nil))
which triggers the assertion in the arm back-end, because the MEM is not aligned.
To fix that I changed exp_equiv_p to consider MEMs with different MEM_ALIGN or
ALIAS_SET as different.
This patch fixes the arm bootstrap for --with-cpu=cortex-a57 --with-mode=thumb --with-fpu=fp-armv8 --with-float=hard
which I confirmed using a cross compiler. And it fixes the test case that is attached to the PR, but it is way
too large for the test suite.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-pr91708.diff --]
[-- Type: text/x-patch; name="patch-pr91708.diff", Size: 1000 bytes --]
2019-09-10 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR middle-end/91708
* cse.c (exp_equiv_p): Consider MEMs with different
alias set or alignment as different.
--- gcc/cse.c.orig 2019-07-24 21:21:53.590065924 +0200
+++ gcc/cse.c 2019-09-10 16:15:37.899933738 +0200
@@ -2637,8 +2637,13 @@ exp_equiv_p (const_rtx x, const_rtx y, i
if (GET_MODE (x) != GET_MODE (y))
return 0;
- /* MEMs referring to different address space are not equivalent. */
- if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
+ /* MEMs referring to different address spaces are not equivalent.
+ MEMs with different alias sets are not equivalent either.
+ Also the MEM_ALIGN needs to be identical in order not to break
+ constraints of insn's that need certain alignment (see PR91708). */
+ if (code == MEM && (MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y)
+ || MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y)
+ || MEM_ALIGN (x) != MEM_ALIGN (y)))
return 0;
switch (code)
next reply other threads:[~2019-09-10 19:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 19:51 Bernd Edlinger [this message]
2019-09-10 22:43 ` Jeff Law
2019-09-11 13:33 ` Bernd Edlinger
2019-09-11 13:37 ` Richard Biener
2019-09-11 16:04 ` Jeff Law
2019-09-11 7:23 ` Richard Biener
2019-09-11 13:49 ` Bernd Edlinger
2019-09-11 13:55 ` Richard Biener
2019-09-11 14:41 ` Bernd Edlinger
2019-09-11 15:38 ` Richard Biener
2019-09-11 16:08 ` Jeff Law
2019-09-11 17:41 ` Bernd Edlinger
2019-09-11 18:30 ` Richard Biener
2019-09-11 19:33 ` Bernd Edlinger
2019-09-12 8:08 ` Richard Biener
2019-09-12 14:27 ` Bernd Edlinger
2019-09-13 11:23 ` Richard Biener
2019-09-13 15:26 ` Bernd Edlinger
2019-09-13 16:56 ` Richard Biener
2019-09-11 16:39 Wilco Dijkstra
2019-09-11 17:40 ` Jeff Law
2019-09-11 18:08 ` Wilco Dijkstra
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=AM6PR10MB2566D9B47A2676B890457CB3E4B60@AM6PR10MB2566.EURPRD10.PROD.OUTLOOK.COM \
--to=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=law@redhat.com \
--cc=rguenther@suse.de \
/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).