re PR rtl-optimization/41087 (cris-elf gfortran.dg/zero_sized_3.f90 -O3 -funroll...
authorHans-Peter Nilsson <hp@axis.com>
Mon, 13 Sep 2010 00:49:27 +0000 (00:49 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 13 Sep 2010 00:49:27 +0000 (00:49 +0000)
PR rtl-optimization/41087
* ifcvt.c (noce_get_condition): Don't allow conditions with
side-effects.

From-SVN: r164240

gcc/ChangeLog
gcc/ifcvt.c

index db8a1fd63cdb3df67b5d56c7734fd17996a05f89..0af0353ed0fa1b2f5c3c2a19e056f73523e28c33 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-13  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR rtl-optimization/41087
+       * ifcvt.c (noce_get_condition): Don't allow conditions with
+       side-effects.
+
 2010-09-12  Anatoly Sokolov  <aesok@post.ru>
 
        * config/frv/frv.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove.
index 9ac4b13caa757f2c4e8c1b935ab73ba1471365ca..9aff583ae45835e6afddbe9a8dff51df8462545c 100644 (file)
@@ -2201,8 +2201,15 @@ noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed)
 
   /* Otherwise, fall back on canonicalize_condition to do the dirty
      work of manipulating MODE_CC values and COMPARE rtx codes.  */
-  return canonicalize_condition (jump, cond, reverse, earliest,
-                                NULL_RTX, false, true);
+  tmp = canonicalize_condition (jump, cond, reverse, earliest,
+                               NULL_RTX, false, true);
+
+  /* We don't handle side-effects in the condition, like handling
+     REG_INC notes and making sure no duplicate conditions are emitted.  */
+  if (tmp != NULL_RTX && side_effects_p (tmp))
+    return NULL_RTX;
+
+  return tmp;
 }
 
 /* Return true if OP is ok for if-then-else processing.  */