+2012-08-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/53411
+       PR rtl-optimization/53495
+       * ira.c (ira): Move delete_trivially_dead_insns call before
+       find_moveable_pseudos call.
+
 2012-08-13  Steven Bosscher  <steven@gcc.gnu.org>
 
        * tree-ssa-pre.c (do_regular_insertion): Add FIXME markers at points
 
 
   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.  */
     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 ();
 
+2012-08-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/53411
+       PR rtl-optimization/53495
+       * gcc.c-torture/compile/pr53411.c: New test.
+       * gcc.c-torture/compile/pr53495.c: New test.
+
 2012-08-13  Richard Guenther  <rguenther@suse.de>
 
        * gcc.dg/tree-prof/update-loopch.c: Adjust.
 
--- /dev/null
+/* 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;
+}
 
--- /dev/null
+/* 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;
+}