df-scan: remove ad-hoc handling of global regs in asms
authorAlexander Monakov <amonakov@ispras.ru>
Wed, 23 May 2018 15:01:28 +0000 (18:01 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Wed, 23 May 2018 15:01:28 +0000 (18:01 +0300)
PR rtl-optimization/79985
* df-scan.c (df_insn_refs_collect): Remove special case for
global registers and asm statements.

testsuite/
* gcc.dg/pr79985.c: New testcase.

From-SVN: r260613

gcc/ChangeLog
gcc/df-scan.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr79985.c [new file with mode: 0644]

index 5eb348067917d3c37f113820681c7c036a3f1477..270c979e84ed3cf29f28aa4f3c6660de55b5933f 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-23  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/79985
+       * df-scan.c (df_insn_refs_collect): Remove special case for
+       global registers and asm statements.
+
 2018-05-23  Alexander Monakov  <amonakov@ispras.ru>
 
        * extend.texi (Global Register Variables): Rewrite the bullet list.
index 95e1e0df2d5bc78f7f3d5eafaa3ee433a14d23dc..cbb08fc36aee3a0f8d02eec98dfb93977372b397 100644 (file)
@@ -3207,17 +3207,6 @@ df_insn_refs_collect (struct df_collection_rec *collection_rec,
   if (CALL_P (insn_info->insn))
     df_get_call_refs (collection_rec, bb, insn_info, flags);
 
-  if (asm_noperands (PATTERN (insn_info->insn)) >= 0)
-    for (unsigned i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-      if (global_regs[i])
-       {
-         /* As with calls, asm statements reference all global regs. */
-         df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
-                        NULL, bb, insn_info, DF_REF_REG_USE, flags);
-         df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
-                        NULL, bb, insn_info, DF_REF_REG_DEF, flags);
-       }
-
   /* Record other defs.  These should be mostly for DF_REF_REGULAR, so
      that a qsort on the defs is unnecessary in most cases.  */
   df_defs_record (collection_rec,
index b3cf4b1fd95c04b5fc9a87d0c34e8c16fcd9eb71..5b16f44d8ff9f1d02b900947d9061e4b57342b02 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-23  Alexander Monakov  <amonakov@ispras.ru>
+
+       * gcc.dg/pr79985.c: New testcase.
+
 2018-05-23  Richard Biener  <rguenther@suse.de>
 
        * gcc.dg/tree-ssa/ssa-fre-66.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr79985.c b/gcc/testsuite/gcc.dg/pr79985.c
new file mode 100644 (file)
index 0000000..7b5a5b2
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR rtl-optimization/79985 */
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O3 -fschedule-insns -fselective-scheduling" } */
+
+long a;
+int b;
+void
+c ()
+{
+  __asm("" : "=r"(a) : "0"(c));
+  __asm("" : "=r"(b));
+}