diff options
author | J"orn Rennecke <amylaar@cygnus.co.uk> | 1999-08-04 22:13:14 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 1999-08-04 23:13:14 +0100 |
commit | edd6ede777870525c0a564d4df6e31431cc69f7c (patch) | |
tree | 5bb9181d09a8d1f3669253e0406e3f689da28e37 /gcc | |
parent | 45fa5f9f144c2cf44fcb2599a5bd6715ef5311fa (diff) | |
download | gcc-edd6ede777870525c0a564d4df6e31431cc69f7c.zip gcc-edd6ede777870525c0a564d4df6e31431cc69f7c.tar.gz gcc-edd6ede777870525c0a564d4df6e31431cc69f7c.tar.bz2 |
final.c (shorten_branches): Don't add an alignment for loops that have no label inside.
* final.c (shorten_branches): Don't add an alignment for loops
that have no label inside.
From-SVN: r28517
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/final.c | 32 |
2 files changed, 28 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0ae4eac..d414f6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Wed Aug 4 20:45:04 1999 J"orn Rennecke <amylaar@cygnus.co.uk> + + * final.c (shorten_branches): Don't add an alignment for loops + that have no label inside. + Wed Aug 4 16:39:24 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * builtins.c (expand_builtin_memcmp, expand_builtin_strcmp): Wrap diff --git a/gcc/final.c b/gcc/final.c index 79a973e..a608041 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; |