aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-12-19 12:27:20 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-12-19 12:27:20 -0800
commit667a4593fc3d98b4d4ca7759ba2f291a8c974d03 (patch)
tree24036833f2829fafa92587e82571c1aee33635c3 /gcc/loop.c
parent3ab7aa12380178bd9b3134a16b73fe50154303f4 (diff)
downloadgcc-667a4593fc3d98b4d4ca7759ba2f291a8c974d03.zip
gcc-667a4593fc3d98b4d4ca7759ba2f291a8c974d03.tar.gz
gcc-667a4593fc3d98b4d4ca7759ba2f291a8c974d03.tar.bz2
(invariant_p): Reject const volatile references.
From-SVN: r8666
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 123c013..885a7f4 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -2699,6 +2699,12 @@ invariant_p (x)
return n_times_set[REGNO (x)] == 0;
case MEM:
+ /* Volatile memory references must be rejected. Do this before
+ checking for read-only items, so that volatile read-only items
+ will be rejected also. */
+ if (MEM_VOLATILE_P (x))
+ return 0;
+
/* Read-only items (such as constants in a constant pool) are
invariant if their address is. */
if (RTX_UNCHANGING_P (x))
@@ -2706,9 +2712,7 @@ invariant_p (x)
/* If we filled the table (or had a subroutine call), any location
in memory could have been clobbered. */
- if (unknown_address_altered
- /* Don't mess with volatile memory references. */
- || MEM_VOLATILE_P (x))
+ if (unknown_address_altered)
return 0;
/* See if there is any dependence between a store and this load. */