summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-04 22:13:14 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-04 22:13:14 +0000
commit9bebd218606e6fc0c42abc05d3ccdb664eafd628 (patch)
tree5bb9181d09a8d1f3669253e0406e3f689da28e37 /gcc/final.c
parent0c5245eb613de9321a25ee9b1cf0a81faf4b9768 (diff)
downloadgcc-9bebd218606e6fc0c42abc05d3ccdb664eafd628.tar.gz
* final.c (shorten_branches): Don't add an alignment for loops
that have no label inside. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28517 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/gcc/final.c b/gcc/final.c
index 79a973e89a1..a6080418ac5 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1113,18 +1113,32 @@ shorten_branches (first)
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
{
rtx label;
+ int nest = 0;
+ /* Search for the label that starts the loop.
+ Don't skip past the end of the loop, since that could
+ lead to putting an alignment where it does not belong.
+ However, a label after a nested (non-)loop would be OK. */
for (label = insn; label; label = NEXT_INSN (label))
- if (GET_CODE (label) == CODE_LABEL)
- {
- log = LOOP_ALIGN (insn);
- if (max_log < log)
- {
- max_log = log;
- max_skip = LOOP_ALIGN_MAX_SKIP;
- }
+ {
+ if (GET_CODE (label) == NOTE
+ && NOTE_LINE_NUMBER (label) == NOTE_INSN_LOOP_BEG)
+ nest++;
+ else if (GET_CODE (label) == NOTE
+ && NOTE_LINE_NUMBER (label) == NOTE_INSN_LOOP_END
+ && --nest == 0)
break;
- }
+ else if (GET_CODE (label) == CODE_LABEL)
+ {
+ log = LOOP_ALIGN (insn);
+ if (max_log < log)
+ {
+ max_log = log;
+ max_skip = LOOP_ALIGN_MAX_SKIP;
+ }
+ break;
+ }
+ }
}
else
continue;