This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, PR target/70160] Support uninitialized register uses in STV pass


Hi,

This patch is for PR70160.  The problem is that when we build
instructions chain for conversion in STV pass we don't include
instruction using unitialized register value but don't skip
them when convert register.  This patch simply fixes it by
skipping such register uses.  Bootstrapped and tested on
x86_64-pc-linux-gnu {-m32}.  OK for trunk?

Thanks,
Ilya
--
gcc/

2016-03-11  Ilya Enkovich  <enkovich.gnu@gmail.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR target/70160
	* config/i386/i386.c (scalar_chain::convert_reg): Skip uses
	of uninitialized values.

gcc/testsuite/

2016-03-11  Ilya Enkovich  <enkovich.gnu@gmail.com>

	PR target/70160
	* gcc.target/i386/pr70160.c: New test.


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index fa7d3ff..3d8dbc4 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3372,8 +3372,11 @@ scalar_chain::convert_reg (unsigned regno)
 	    bitmap_clear_bit (conv, DF_REF_INSN_UID (ref));
 	  }
       }
-    else if (NONDEBUG_INSN_P (DF_REF_INSN (ref)))
+    /* Skip debug insns and uninitialized uses.  */
+    else if (DF_REF_CHAIN (ref)
+	     && NONDEBUG_INSN_P (DF_REF_INSN (ref)))
       {
+	gcc_assert (scopy);
 	replace_rtx (DF_REF_INSN (ref), reg, scopy);
 	df_insn_rescan (DF_REF_INSN (ref));
       }
diff --git a/gcc/testsuite/gcc.target/i386/pr70160.c b/gcc/testsuite/gcc.target/i386/pr70160.c
new file mode 100644
index 0000000..725e955
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr70160.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -msse2 -Wno-uninitialized -Wno-maybe-uninitialized" } */
+
+long long a;
+void fn1();
+void fn2(unsigned t, int a_int, unsigned p)
+{
+  long long x;
+  int i, j = 1;
+  t = i;
+  for (; j;) {
+    a = x;
+    x = 1 + t;
+    j += a_int;
+    fn1();
+    if (x == 1)
+      return;
+  }
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]