Commit 66f91b93 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR rtl-optimization/35729 (const volatile variable access incorrectly hoisted out of loop)

	PR rtl-optimization/35729
	* loop-invariant.c (check_maybe_invariant): Disallow volatile memory
	references.

	* gcc.dg/pr35729.c: New test.

From-SVN: r133755
parent 6b20c50f
2008-03-31 Zdenek Dvorak <ook@ucw.cz>
PR rtl-optimization/35729
* loop-invariant.c (check_maybe_invariant): Disallow volatile memory
references.
2008-03-31 H.J. Lu <hongjiu.lu@intel.com>
PR target/32000
......
......@@ -206,7 +206,7 @@ check_maybe_invariant (rtx x)
/* Just handle the most trivial case where we load from an unchanging
location (most importantly, pic tables). */
if (MEM_READONLY_P (x))
if (MEM_READONLY_P (x) && !MEM_VOLATILE_P (x))
break;
return false;
......
2008-03-31 Zdenek Dvorak <ook@ucw.cz>
PR rtl-optimization/35729
* gcc.dg/pr35729.c: New test.
2008-03-31 H.J. Lu <hongjiu.lu@intel.com>
PR target/32000
/* { dg-do compile } */
/* { dg-options "-Os -fdump-rtl-loop2_invariant" } */
const volatile int g_361 = 3L;
volatile int g_2 = 0L;
void func_1 (void)
{
for (g_2 = 0; g_2 > 10; g_2++)
{
int l_357 = g_361;
}
}
/* { dg-final { scan-rtl-dump-times "Decided to move invariant" 0 "loop2_invariant" } } */
/* { dg-final { cleanup-rtl-dump "loop2_invariant" } } */
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