diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0b859c56d6a28b9fc9972e484ea34249748f8f03..92f3ddb9dfd1ced6093d1b46cf52e7cb9cc407dc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2011-02-11  Pat Haugen <pthaugen@us.ibm.com>
+
+	PR rtl-optimization/47614
+	* rtl.h (check_for_inc_dec): Declare.
+	* dse.c (check_for_inc_dec): Externalize...
+	* postreload.c (reload_cse_simplify): ...use it before deleting stmt.
+	(reload_cse_simplify_operands): Don't simplify opnds with side effects.
+
 2011-02-11  Joseph Myers  <joseph@codesourcery.com>
 
 	PR driver/47678
diff --git a/gcc/dse.c b/gcc/dse.c
index 11639816bca7ff195e48f528f8697780fed716ad..8e9b6454e390ff7caba8a55e6c34470b27c1ccfd 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -830,7 +830,7 @@ emit_inc_dec_insn_before (rtx mem ATTRIBUTE_UNUSED,
 /* Before we delete INSN, make sure that the auto inc/dec, if it is
    there, is split into a separate insn.  */
 
-static void
+void
 check_for_inc_dec (rtx insn)
 {
   rtx note = find_reg_note (insn, REG_INC, NULL_RTX);
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 5cd26a79ddf1636747e456e229ca9409beff991a..a4234102301433b9c6a9f299dcd3f01a2b487853 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -112,6 +112,7 @@ reload_cse_simplify (rtx insn, rtx testreg)
 	  if (REG_P (value)
 	      && ! REG_FUNCTION_VALUE_P (value))
 	    value = 0;
+	  check_for_inc_dec (insn);
 	  delete_insn_and_edges (insn);
 	  return;
 	}
@@ -163,6 +164,7 @@ reload_cse_simplify (rtx insn, rtx testreg)
 
       if (i < 0)
 	{
+	  check_for_inc_dec (insn);
 	  delete_insn_and_edges (insn);
 	  /* We're done with this insn.  */
 	  return;
@@ -476,6 +478,8 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
 	    continue;
 	}
 #endif /* LOAD_EXTEND_OP */
+      if (side_effects_p (op))
+	continue;
       v = cselib_lookup (op, recog_data.operand_mode[i], 0, VOIDmode);
       if (! v)
 	continue;
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 268613b6f1ceadc7ccaeeef1ea6d702ce966968f..e5c6e38302055b7fb4096ba2c5d3cba6d78b00bb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2302,6 +2302,9 @@ extern int cse_main (rtx, int);
 extern int exp_equiv_p (const_rtx, const_rtx, int, bool);
 extern unsigned hash_rtx (const_rtx x, enum machine_mode, int *, int *, bool);
 
+/* In dse.c */
+extern void check_for_inc_dec (rtx insn);
+
 /* In jump.c */
 extern int comparison_dominates_p (enum rtx_code, enum rtx_code);
 extern int condjump_p (const_rtx);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b9406bab86db2de0ad909dc447a722e21394e81b..d680a16d3097d92c8411905c90fc56cbbe1b0c17 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-11  Pat Haugen <pthaugen@us.ibm.com>
+
+	PR rtl-optimization/47614
+	* gfortran.dg/pr47614.f: New.
+
 2011-02-11  Joseph Myers  <joseph@codesourcery.com>
 
 	PR driver/47678
diff --git a/gcc/testsuite/gfortran.dg/pr47614.f b/gcc/testsuite/gfortran.dg/pr47614.f
new file mode 100644
index 0000000000000000000000000000000000000000..52f14c0c17b091869c62b64d40fd0972166dcaad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr47614.f
@@ -0,0 +1,37 @@
+! { dg-do run { target { powerpc*-*-* } } }
+! { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } }
+! { dg-options "-O3 -funroll-loops -ffast-math -mcpu=power4" }
+
+
+      SUBROUTINE SFCPAR(ZET,NZ,ZMH,TSL,TMES)
+      IMPLICIT REAL*8 (A-H, O-Z)
+      REAL*8 ZET(*)
+
+      ZS=MAX(TSL*ZMH,ZET(2))
+
+      DO 10 K=2,NZ
+         KLEV=K-1
+         IF(ZS.LE.ZET(K)) GO TO 20
+ 10   CONTINUE
+
+ 20   CONTINUE
+      TMES=ZET(KLEV+1)
+      
+      RETURN
+      END
+
+      program pr47614
+	real*8 ar1(10),d1,d2,d3
+	integer i
+
+	d1 = 2.0
+	d2 = 3.0
+	d3 = 3.0
+	do 50 i=1,10
+	  ar1(i) = d1
+	  d1 = d1 + 2.0
+ 50	continue
+
+	call sfcpar(ar1,10,d2,d3,d1)
+	if (d1.ne.10.0) call abort()
+      end