Commit 8821d091 by Eric Botcazou Committed by Eric Botcazou

re PR rtl-optimization/11381 (volatile memory access optimized away)

	PR optimization/11381
	* simplify-rtx.c (simplify_relational_operation): Check that
	two equal operands have no side-effects before simplifying
	the comparison.

From-SVN: r68869
parent 7960bf22
2003-07-03 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11381
* simplify-rtx.c (simplify_relational_operation): Check that
two equal operands have no side-effects before simplifying
the comparison.
2003-07-02 Jeff Law <law@redhat.com> 2003-07-02 Jeff Law <law@redhat.com>
* expr.c (do_store_flag): Remove special case folding for * expr.c (do_store_flag): Remove special case folding for
......
...@@ -2220,8 +2220,10 @@ simplify_relational_operation (code, mode, op0, op1) ...@@ -2220,8 +2220,10 @@ simplify_relational_operation (code, mode, op0, op1)
return const0_rtx; return const0_rtx;
/* For modes without NaNs, if the two operands are equal, we know the /* For modes without NaNs, if the two operands are equal, we know the
result. */ result except if they have side-effects. */
if (!HONOR_NANS (GET_MODE (trueop0)) && rtx_equal_p (trueop0, trueop1)) if (! HONOR_NANS (GET_MODE (trueop0))
&& rtx_equal_p (trueop0, trueop1)
&& ! side_effects_p (trueop0))
equal = 1, op0lt = 0, op0ltu = 0, op1lt = 0, op1ltu = 0; equal = 1, op0lt = 0, op0ltu = 0, op1lt = 0, op1ltu = 0;
/* If the operands are floating-point constants, see if we can fold /* If the operands are floating-point constants, see if we can fold
......
2003-07-03 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/i386-volatile-1.c: New test.
2003-07-02 Nathan Sidwell <nathan@codesourcery.com> 2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11072 PR c++/11072
......
/* PR optimization/11381 */
/* Originator: <tobias@ringstrom.mine.nu> */
/* { dg-do compile { target i?86-*-* } } */
/* { dg-options "-O" } */
/* Verify that the comparison is not optimized away. */
void foo(volatile unsigned int *vaddr)
{
while (*vaddr != *vaddr)
;
}
/* { dg-final { scan-assembler "cmp" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment