]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtlanal: dead_or_set_regno_p should handle CLOBBER (PR83424)
authorSegher Boessenkool <segher@kernel.crashing.org>
Mon, 18 Dec 2017 20:16:19 +0000 (21:16 +0100)
committerSegher Boessenkool <segher@gcc.gnu.org>
Mon, 18 Dec 2017 20:16:19 +0000 (21:16 +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: r255787

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

index a4a2afe6348b88a61f04bd7db69af1545b4744c3..948271e28e6b50078d7c705d41324d48c4d86b76 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2017-12-18  Marek Polacek  <polacek@redhat.com>
 
        PR middle-end/83463
index c91f3f1d81ee86fb7c935c7c37547df5887e058b..9f6988bc8c56ad5e945ea78c9b5dd739a5d75fa4 100644 (file)
@@ -2082,7 +2082,7 @@ dead_or_set_regno_p (const rtx_insn *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 ae1fd01fb79e996990bef179027abb14a5c07185..da078f123304d99ff8f2395e6d0fce0bad73ece6 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-18  Segher Boessenkool  <segher@kernel.crashing.org>
+
+       PR rtl-optimization/83424
+       * gcc.dg/pr83424.c: New testcase.
+
 2017-12-18  David Malcolm  <dmalcolm@redhat.com>
 
        PR tree-optimization/83336
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;
+}