public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9611] valtrack: Avoid creating raw SUBREGs with VOIDmode argument [PR104557]
@ 2022-02-19  8:03 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-02-19  8:03 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3eecfec27666b16b2ef855f32ba3f975e087dec1

commit r11-9611-g3eecfec27666b16b2ef855f32ba3f975e087dec1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 17 11:14:38 2022 +0100

    valtrack: Avoid creating raw SUBREGs with VOIDmode argument [PR104557]
    
    After the recent r12-7240 simplify_immed_subreg changes, we bail on more
    simplify_subreg calls than before, e.g. apparently for decimal modes
    in the NaN representations  we almost never preserve anything except the
    canonical {q,s}NaNs.
    simplify_gen_subreg will punt in such cases because a SUBREG with VOIDmode
    is not valid, but debug_lowpart_subreg wants to attempt even harder, even
    if e.g. target indicates certain mode combinations aren't valid for the
    backend, dwarf2out can still handle them.  But a SUBREG from a VOIDmode
    operand is just too much, the inner mode is lost there.  We'd need some
    new rtx that would be able to represent those cases.
    For now, just punt in those cases.
    
    2022-02-17  Jakub Jelinek  <jakub@redhat.com>
    
            PR debug/104557
            * valtrack.c (debug_lowpart_subreg): Don't call gen_rtx_raw_SUBREG
            if expr has VOIDmode.
    
            * gcc.dg/dfp/pr104557.c: New test.
    
    (cherry picked from commit 1c2b44b52364cb5661095b346de794bc7ff02866)

Diff:
---
 gcc/testsuite/gcc.dg/dfp/pr104557.c | 22 ++++++++++++++++++++++
 gcc/valtrack.c                      |  4 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/dfp/pr104557.c b/gcc/testsuite/gcc.dg/dfp/pr104557.c
new file mode 100644
index 00000000000..a4a1cc63409
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr104557.c
@@ -0,0 +1,22 @@
+/* PR debug/104557 */
+/* { dg-do compile } */
+/* { dg-options "-O -g -Wno-psabi" } */
+
+typedef int __attribute__((__vector_size__ (32))) U;
+typedef double __attribute__((__vector_size__ (32))) F;
+typedef _Decimal64 __attribute__((__vector_size__ (32))) D;
+
+F
+bar (void)
+{
+  F f = __builtin_convertvector ((D) (-10.d < (D) ((D) (U) { 0, 0, 0, 0, 0, 0, 0, -0xe0 }
+						   >= (D) { 80000000 })), F);
+  return f;
+}
+
+F
+foo ()
+{
+  F x = bar ();
+  return x;
+}
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 225b0fc24a9..14d6f3c5752 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -559,7 +559,9 @@ debug_lowpart_subreg (machine_mode outer_mode, rtx expr,
   rtx ret = simplify_gen_subreg (outer_mode, expr, inner_mode, offset);
   if (ret)
     return ret;
-  return gen_rtx_raw_SUBREG (outer_mode, expr, offset);
+  if (GET_MODE (expr) != VOIDmode)
+    return gen_rtx_raw_SUBREG (outer_mode, expr, offset);
+  return NULL_RTX;
 }
 
 /* If UREGNO is referenced by any entry in DEBUG, emit a debug insn


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

only message in thread, other threads:[~2022-02-19  8:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19  8:03 [gcc r11-9611] valtrack: Avoid creating raw SUBREGs with VOIDmode argument [PR104557] Jakub Jelinek

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