]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)
authorSegher Boessenkool <segher@kernel.crashing.org>
Tue, 16 Jan 2018 16:30:43 +0000 (17:30 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Tue, 16 Jan 2018 16:30:43 +0000 (17:30 +0100)
In PR83424 combine's move_deaths puts a REG_DEAD note in the wrong place
because dead_or_set_regno_p does not account for CLOBBER insns.  This
fixes it.

PR rtl-optimization/83424
* rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.

gcc/testsuite/
PR rtl-optimization/83424
* gcc.dg/pr83424.c: New testsuite.

From-SVN: r256752

gcc/ChangeLog
gcc/rtlanal.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr83424.c [new file with mode: 0644]

index b17b12ae7de8cfe16a3c9d9ae4e2414158779f39..bdd50afb226c694caaae6f7529d77b00e61be81e 100644 (file)
@@ -1,3 +1,11 @@
+2018-01-16  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2017-12-18  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/83424
+       * rtlanal.c (dead_or_set_regno_p): Handle CLOBBER just like SET.
+
 2018-01-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline
        * config/i386/i386.h: (host_detect_local_cpu): New define.
        (TARGET_EMIT_VZEROUPPER): New.
        * config/i386/x86-tune.def: Add X86_TUNE_EMIT_VZEROUPPER
-       
+
 2017-12-01  Segher Boessenkool  <segher@kernel.crashing.org>
 
        Backport from mainline
index 876b90febbb951db21af1d5d718687c82c57c348..6d9d314eb187994846cda3f0a6857ab4b6f46ed8 100644 (file)
@@ -2064,7 +2064,7 @@ dead_or_set_regno_p (const_rtx insn, unsigned int test_regno)
   if (GET_CODE (pattern) == COND_EXEC)
     return 0;
 
-  if (GET_CODE (pattern) == SET)
+  if (GET_CODE (pattern) == SET || GET_CODE (pattern) == CLOBBER)
     return covers_regno_p (SET_DEST (pattern), test_regno);
   else if (GET_CODE (pattern) == PARALLEL)
     {
index 48b2a18f813e81a359e47586fca831f670d9b680..0a489731028c7fdd4f1c3b546f38cdfe91fa67fe 100644 (file)
@@ -1,3 +1,11 @@
+2018-01-16  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       Backport from mainline
+       2017-12-18  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/83424
+       * gcc.dg/pr83424.c: New testsuite.
+
 2018-01-14  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/pr83424.c b/gcc/testsuite/gcc.dg/pr83424.c
new file mode 100644 (file)
index 0000000..5a304f5
--- /dev/null
@@ -0,0 +1,30 @@
+/* PR rtl-optimization/83424 */
+/* { dg-do run { target int128 } } */
+/* { dg-options "-O -fno-tree-ccp -fno-tree-coalesce-vars" } */
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+typedef unsigned __int128 u128;
+
+u32 a, c;
+u8 b;
+
+static u128 __attribute__ ((noinline, noclone))
+foo (u128 p)
+{
+  u8 x = ~b;
+  p &= c;
+  x *= -p;
+  x &= a == 0;
+  x >>= 1;
+  return p + x;
+}
+
+int
+main (void)
+{
+  u128 x = foo (0);
+  if (x != 0)
+    __builtin_abort ();
+  return 0;
+}