summaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-17 20:59:40 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-17 20:59:40 +0000
commit43b6ba4524af49f06807042914b69ff7be886471 (patch)
tree6246e46226dfe3ca8100baf6e693f108a7fa2483 /gcc/alias.c
parent62b5416559ae6accd131515a2694372854e8f295 (diff)
downloadgcc-43b6ba4524af49f06807042914b69ff7be886471.tar.gz
PR rtl-optimization/54900
* ifcvt.c (noce_can_store_speculate_p): Call memory_must_be_modified_in_insn_p. * alias.c (memory_must_be_modified_in_insn_p): New. (set_dest_equal_p): New. * rtl.h (memory_must_be_modified_in_p): Protoize. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192548 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index 244ca520c92..c5e64176313 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2762,6 +2762,39 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
return memory_modified;
}
+/* Return TRUE if the destination of a set is rtx identical to
+ ITEM. */
+static inline bool
+set_dest_equal_p (const_rtx set, const_rtx item)
+{
+ rtx dest = SET_DEST (set);
+ return rtx_equal_p (dest, item);
+}
+
+/* Like memory_modified_in_insn_p, but return TRUE if INSN will
+ *DEFINITELY* modify the memory contents of MEM. */
+bool
+memory_must_be_modified_in_insn_p (const_rtx mem, const_rtx insn)
+{
+ if (!INSN_P (insn))
+ return false;
+ insn = PATTERN (insn);
+ if (GET_CODE (insn) == SET)
+ return set_dest_equal_p (insn, mem);
+ else if (GET_CODE (insn) == PARALLEL)
+ {
+ int i;
+ for (i = 0; i < XVECLEN (insn, 0); i++)
+ {
+ rtx sub = XVECEXP (insn, 0, i);
+ if (GET_CODE (sub) == SET
+ && set_dest_equal_p (sub, mem))
+ return true;
+ }
+ }
+ return false;
+}
+
/* Initialize the aliasing machinery. Initialize the REG_KNOWN_VALUE
array. */