--- gcc/ira.c.jj	2012-08-10 12:57:39.000000000 +0200
+++ gcc/ira.c	2012-08-13 13:23:08.137339807 +0200
@@ -4206,6 +4206,9 @@ ira (FILE *f)
 
   allocated_reg_info_size = max_reg_num ();
 
+  if (delete_trivially_dead_insns (get_insns (), max_reg_num ()))
+    df_analyze ();
+
   /* It is not worth to do such improvement when we use a simple
      allocation because of -O0 usage or because the function is too
      big.  */
@@ -4288,9 +4291,6 @@ ira (FILE *f)
     check_allocation ();
 #endif
 
-  if (delete_trivially_dead_insns (get_insns (), max_reg_num ()))
-    df_analyze ();
-
   if (max_regno != max_regno_before_ira)
     {
       regstat_free_n_sets_and_refs ();
--- gcc/testsuite/gcc.c-torture/compile/pr53411.c.jj	2012-08-13 12:53:23.153131907 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr53411.c	2012-08-13 12:53:01.000000000 +0200
@@ -0,0 +1,33 @@
+/* PR middle-end/53411 */
+
+int a, b, c, d, e, f, g, h;
+void fn1 (void);
+int fn2 (void);
+
+int
+fn3 (x)
+     int x;
+{
+  return a ? 0 : x;
+}
+
+void
+fn4 (char x)
+{
+  int i, j, k;
+  for (; e; e++)
+    if (fn2 ())
+      {
+	f = 1;
+	k = 0;
+	for (; k <= 1; k++)
+	  {
+	    j = ~x;
+	    i = f * j;
+	    h = (fn3 (i | 0 <= c ^ 9L) != b | d) & 8;
+	    g = x | 1;
+	    fn1 ();
+	  }
+      }
+  c = x;
+}
--- gcc/testsuite/gcc.c-torture/compile/pr53495.c.jj	2012-08-13 12:28:27.311493428 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr53495.c	2012-08-13 12:27:57.000000000 +0200
@@ -0,0 +1,41 @@
+/* PR rtl-optimization/53495 */
+
+int a, b, c, d, e, g;
+static char
+fn1 (char p1, int p2)
+{
+  return p1 || p2 < 0 || p2 >= 1 || 1 >> p2 ? p1 : 0;
+}
+
+static long long fn2 (int *, int);
+static int fn3 ();
+void
+fn4 ()
+{
+  fn3 ();
+  fn2 (&a, d);
+}
+
+long long
+fn2 (int *p1, int p2)
+{
+  int f = -1L;
+  for (; c <= 1; c++)
+    {
+      *p1 = 0;
+      *p1 = fn1 (c, p2 ^ f);
+    }
+  a = 0;
+  e = p2;
+  return 0;
+}
+
+int
+fn3 ()
+{
+  b = 3;
+  for (; b; b--)
+    c++;
+  g = 0 >= c;
+  return 0;
+}
