diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c784188a26726491caf689787586fef5664072d5..b0c8ad37079c844f0c163f8b137c359be8271277 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-16  Jan Hubicka  <jh@suse.cz>
+
+	PR tree-optimization/54717
+	* tree-ssa-pre.c (do_partial_partial_insertion): Consider also edges
+	with ANTIC_IN.
+
 2012-11-16  Uros Bizjak  <ubizjak@gmail.com>
 
 	* config/i386/i386-protos.h (ix86_emit_mode_set): Add third argument.
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 191de51b75d2636804cac2ee1905dec39e043a5e..6876dd4c5b75f1f4772a9b42f833652257a7818b 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3525,7 +3525,8 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
 		 may cause regressions on the speed path.  */
 	      FOR_EACH_EDGE (succ, ei, block->succs)
 		{
-		  if (bitmap_set_contains_value (PA_IN (succ->dest), val))
+		  if (bitmap_set_contains_value (PA_IN (succ->dest), val)
+		      || bitmap_set_contains_value (ANTIC_IN (succ->dest), val))
 		    {
 		      if (optimize_edge_for_speed_p (succ))
 			do_insertion = true;
@@ -3539,7 +3540,7 @@ do_partial_partial_insertion (basic_block block, basic_block dom)
 		      fprintf (dump_file, "Skipping partial partial redundancy "
 			       "for expression ");
 		      print_pre_expr (dump_file, expr);
-		      fprintf (dump_file, " (%04d), not partially anticipated "
+		      fprintf (dump_file, " (%04d), not (partially) anticipated "
 			       "on any to be optimized for speed edges\n", val);
 		    }
 		}