summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authorDoug Evans <dje@gnu.org>1997-03-28 22:37:37 +0000
committerDoug Evans <dje@gnu.org>1997-03-28 22:37:37 +0000
commitf6a6a1b37dc269a44ebd1b97d9cd7bcc8da4afa3 (patch)
treed0b6e96b02af296d5f28ab6307915793858bca3e /gcc/jump.c
parent9b53bc830d1742473e40a722d634118b11e199b5 (diff)
downloadgcc-f6a6a1b37dc269a44ebd1b97d9cd7bcc8da4afa3.tar.gz
jump.c (jump_optimize, [...]): Disable some optimizations when flag_test_coverage and there is a line number...
* jump.c (jump_optimize, follow_jumps, mark_jump_label): Disable some optimizations when flag_test_coverage and there is a line number note in the way. (invert_jump): Add REG_BR_PROB when flag_branch_probabililties. From-SVN: r13817
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index e1382b38e87..2253f7b04ef 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1869,9 +1869,21 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
&& (next_active_insn (JUMP_LABEL (insn))
== next_active_insn (JUMP_LABEL (temp))))
{
- delete_jump (insn);
- changed = 1;
- continue;
+ rtx tem = temp;
+
+ /* ??? Optional. Disables some optimizations, but makes
+ gcov output more accurate with -O. */
+ if (flag_test_coverage && !reload_completed)
+ for (tem = insn; tem != temp; tem = NEXT_INSN (tem))
+ if (GET_CODE (tem) == NOTE && NOTE_LINE_NUMBER (tem) > 0)
+ break;
+
+ if (tem == temp)
+ {
+ delete_jump (insn);
+ changed = 1;
+ continue;
+ }
}
/* Detect a conditional jump jumping over an unconditional jump. */
@@ -3219,7 +3231,10 @@ follow_jumps (label)
if (!reload_completed)
for (tem = value; tem != insn; tem = NEXT_INSN (tem))
if (GET_CODE (tem) == NOTE
- && NOTE_LINE_NUMBER (tem) == NOTE_INSN_LOOP_BEG)
+ && (NOTE_LINE_NUMBER (tem) == NOTE_INSN_LOOP_BEG
+ /* ??? Optional. Disables some optimizations, but makes
+ gcov output more accurate with -O. */
+ || (flag_test_coverage && NOTE_LINE_NUMBER (tem) > 0)))
return value;
/* If we have found a cycle, make the insn jump to itself. */
@@ -3340,7 +3355,10 @@ mark_jump_label (x, insn, cross_jump)
break;
else if (! cross_jump
&& (NOTE_LINE_NUMBER (next) == NOTE_INSN_LOOP_BEG
- || NOTE_LINE_NUMBER (next) == NOTE_INSN_FUNCTION_END))
+ || NOTE_LINE_NUMBER (next) == NOTE_INSN_FUNCTION_END
+ /* ??? Optional. Disables some optimizations, but
+ makes gcov output more accurate with -O. */
+ || (flag_test_coverage && NOTE_LINE_NUMBER (next) > 0)))
break;
}
@@ -3755,7 +3773,21 @@ invert_jump (jump, nlabel)
return 0;
if (redirect_jump (jump, nlabel))
- return 1;
+ {
+ if (flag_branch_probabilities)
+ {
+ rtx note = find_reg_note (jump, REG_BR_PROB, 0);
+
+ /* An inverted jump means that a probability taken becomes a
+ probability not taken. Subtract the branch probability from the
+ probability base to convert it back to a taken probability.
+ (We don't flip the probability on a branch that's never taken. */
+ if (note && XINT (XEXP (note, 0), 0) >= 0)
+ XINT (XEXP (note, 0), 0) = REG_BR_PROB_BASE - XINT (XEXP (note, 0), 0);
+ }
+
+ return 1;
+ }
if (! invert_exp (PATTERN (jump), jump))
/* This should just be putting it back the way it was. */