Index: gcc/tree-ssa-ter.c
===================================================================
--- gcc/tree-ssa-ter.c  (revision 194632)
+++ gcc/tree-ssa-ter.c  (working copy)
@@ -681,12 +681,13 @@ find_replaceable_in_bb (temp_expr_table_
            kill_expr (tab, partition);
        }
 
-      /* Increment counter if this is a non BUILT_IN call. We allow
-        replacement over BUILT_IN calls since many will expand to inline
-        insns instead of a true call.  */
-      if (is_gimple_call (stmt)
-         && !((fndecl = gimple_call_fndecl (stmt))
-              && DECL_BUILT_IN (fndecl)))
+      /* Increment counter if this is not a BUILT_IN call or a stmt with
+        side-effects.  We allow replacement over BUILT_IN calls
+        since many will expand to inline insns instead of a true call.  
*/
+      if (gimple_has_side_effects (stmt)
+         || (is_gimple_call (stmt)
+             && !((fndecl = gimple_call_fndecl (stmt))
+                  && DECL_BUILT_IN (fndecl))))
        cur_call_cnt++;
 
