aboutsummaryrefslogtreecommitdiff
path: root/gcc/sched-deps.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-08-12 23:24:40 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2014-08-12 23:24:40 +0200
commitc7cf969cdbc688e0e6d486cf62e85be1e4ca4218 (patch)
tree1e88256bef0a3bccd655c38fe76b924cd24e59c5 /gcc/sched-deps.c
parent06a1d02efd4a977fd06774b960ce2d21104ef5e0 (diff)
downloadgcc-c7cf969cdbc688e0e6d486cf62e85be1e4ca4218.zip
gcc-c7cf969cdbc688e0e6d486cf62e85be1e4ca4218.tar.gz
gcc-c7cf969cdbc688e0e6d486cf62e85be1e4ca4218.tar.bz2
re PR target/62025 (Miscompilation of openssl sha512.c)
PR target/62025 * sched-deps.c (find_inc): Check if inc_insn doesn't clobber any registers that are used in mem_insn. From-SVN: r213887
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r--gcc/sched-deps.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 51c1a01..049927f 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -4751,6 +4751,24 @@ find_inc (struct mem_inc_info *mii, bool backwards)
"inc conflicts with store failure.\n");
goto next;
}
+
+ /* The inc instruction could have clobbers, make sure those
+ registers are not used in mem insn. */
+ FOR_EACH_INSN_DEF (def, mii->inc_insn)
+ if (!reg_overlap_mentioned_p (DF_REF_REG (def), mii->mem_reg0))
+ {
+ df_ref use;
+ FOR_EACH_INSN_USE (use, mii->mem_insn)
+ if (reg_overlap_mentioned_p (DF_REF_REG (def),
+ DF_REF_REG (use)))
+ {
+ if (sched_verbose >= 5)
+ fprintf (sched_dump,
+ "inc clobber used in store failure.\n");
+ goto next;
+ }
+ }
+
newaddr = mii->inc_input;
if (mii->mem_index != NULL_RTX)
newaddr = gen_rtx_PLUS (GET_MODE (newaddr), newaddr,