aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1998-01-17 21:50:05 +0000
committerJeff Law <law@gcc.gnu.org>1998-01-17 14:50:05 -0700
commit72ec635f5a09e342acee7752e305be4b49023fee (patch)
tree1f2c3ee528dc36eff6e8def1f98e791d86d5fa08 /gcc/loop.c
parentd9a3317a6806010861b6f640ca1cc76e2044fefc (diff)
downloadgcc-72ec635f5a09e342acee7752e305be4b49023fee.zip
gcc-72ec635f5a09e342acee7752e305be4b49023fee.tar.gz
gcc-72ec635f5a09e342acee7752e305be4b49023fee.tar.bz2
loop.c (find_and_verify_loops): When attempting to move insns from inside the loop outside the loop...
* loop.c (find_and_verify_loops): When attempting to move insns from inside the loop outside the loop, create a BARRIER if no suitable one was found. From-SVN: r17399
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 2226201..0fa3b4f 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -2531,6 +2531,27 @@ find_and_verify_loops (f)
{
rtx q, r;
+ /* If no suitable BARRIER was found, create a suitable
+ one before TARGET. Since TARGET is a fall through
+ path, we'll need to insert an jump around our block
+ and a add a BARRIER before TARGET.
+
+ This creates an extra unconditional jump outside
+ the loop. However, the benefits of removing rarely
+ executed instructions from inside the loop usually
+ outweighs the cost of the extra unconditional jump
+ outside the loop. */
+ if (loc == 0)
+ {
+ rtx temp;
+
+ temp = gen_jump (JUMP_LABEL (insn));
+ temp = emit_jump_insn_before (temp, target);
+ JUMP_LABEL (temp) = JUMP_LABEL (insn);
+ LABEL_NUSES (JUMP_LABEL (insn))++;
+ loc = emit_barrier_before (target);
+ }
+
/* Include the BARRIER after INSN and copy the
block after LOC. */
new_label = squeeze_notes (new_label, NEXT_INSN (insn));