diff options
author | Andrey Belevantsev <abel@ispras.ru> | 2019-04-02 15:39:22 +0000 |
---|---|---|
committer | Alexander Monakov <amonakov@ispras.ru> | 2019-04-02 15:39:22 +0000 |
commit | 57ed54e174ada3c8b949b935b3ece1e1978e2782 (patch) | |
tree | 6a4c4969fc000c5ac257c5db95ba979607693dfe /gcc/sel-sched.c | |
parent | 3ac62d4e197b88ca6caefa2ca94cd25681a9e857 (diff) |
sel-sched: fixup reset of first_insn (PR 85876)
2019-04-02 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/85876
* sel-sched.c (code_motion_path_driver): Avoid unwinding first_insn
beyond the original fence.
* gcc.dg/pr85876.c: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@270095 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sel-sched.c')
-rw-r--r-- | gcc/sel-sched.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c index 552dd0b9263..f6e94bfc15c 100644 --- a/gcc/sel-sched.c +++ b/gcc/sel-sched.c @@ -6439,7 +6439,7 @@ code_motion_path_driver (insn_t insn, av_set_t orig_ops, ilist_t path, { expr_t expr = NULL; basic_block bb = BLOCK_FOR_INSN (insn); - insn_t first_insn, bb_tail, before_first; + insn_t first_insn, original_insn, bb_tail, before_first; bool removed_last_insn = false; if (sched_verbose >= 6) @@ -6523,7 +6523,7 @@ code_motion_path_driver (insn_t insn, av_set_t orig_ops, ilist_t path, /* It is enough to place only heads and tails of visited basic blocks into the PATH. */ ilist_add (&path, insn); - first_insn = insn; + first_insn = original_insn = insn; bb_tail = sel_bb_end (bb); /* Descend the basic block in search of the original expr; this part @@ -6630,6 +6630,8 @@ code_motion_path_driver (insn_t insn, av_set_t orig_ops, ilist_t path, { insn = sel_bb_end (bb); first_insn = sel_bb_head (bb); + if (first_insn != original_insn) + first_insn = original_insn; } /* Remove bb tail from path. */ |