aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDale Johannesen <dalej@gcc.gnu.org>2002-09-17 21:25:13 +0000
committerDale Johannesen <dalej@gcc.gnu.org>2002-09-17 21:25:13 +0000
commitac19be7ebaaa65f6bf5df62db247a57dc41dde57 (patch)
treefcba97f4d21d11195b6b6ea9b77267956a1a7048 /gcc
parent6a0225133cef7f6181a0b656e4952dadce25751b (diff)
downloadgcc-ac19be7ebaaa65f6bf5df62db247a57dc41dde57.zip
gcc-ac19be7ebaaa65f6bf5df62db247a57dc41dde57.tar.gz
gcc-ac19be7ebaaa65f6bf5df62db247a57dc41dde57.tar.bz2
Do not foward a branch to just after a loop exit before
loop optimization; this broke doloop detection. From-SVN: r57260
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cfgcleanup.c9
-rw-r--r--gcc/testsuite/gcc.dg/doloop-1.c18
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7834815..472a9b8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-17 Dale Johannesen <dalej@apple.com>
+ * cfgcleanup.c (try_forward_edges): Do not forward a
+ branch to just after a loop exit before loop optimization;
+ this interfered with doloop detection.
+
2002-09-17 Nick Clifton <nickc@redhat.com>
* config/arm/arm.c (output_return_instruction): Do not
@@ -118,6 +123,7 @@ Tue Sep 17 13:40:13 2002 Nicola Pero <n.pero@mi.flashnet.it>
* real.h (real_nan): Return bool.
* doc/extend.texi: Document new builtins.
+>>>>>>> 1.15460
2002-09-16 Jason Merrill <jason@redhat.com>
Danny Smith <dannysmith@users.sourceforge.net>
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index f6a011a..fe22103 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -515,6 +515,15 @@ try_forward_edges (mode, b)
if (GET_CODE (insn) == NOTE)
break;
+
+ /* Do not clean up branches to just past the end of a loop
+ at this time; it can mess up the loop optimizer's
+ recognition of some patterns. */
+
+ insn = PREV_INSN (target->head);
+ if (insn && GET_CODE (insn) == NOTE
+ && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END)
+ break;
}
counter++;
diff --git a/gcc/testsuite/gcc.dg/doloop-1.c b/gcc/testsuite/gcc.dg/doloop-1.c
new file mode 100644
index 0000000..3561a17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/doloop-1.c
@@ -0,0 +1,18 @@
+/* Make sure both loops are recognized as doloops.
+ If so, "bdnz" will be generated on ppc; if not,
+ you will get "ble". */
+
+/* { dg-do compile { target powerpc-*-* } } */
+/* { dg-options "-O2" } */
+void foo (int count, char* pca, char* pcb) {
+ int i;
+ if (count > 10)
+ for (i = 0; i < count; ++i)
+ pcb += i;
+ else
+ for (i = 0; i < count; ++i)
+ pca += i;
+ *pca = *pcb;
+}
+/* { dg-final { scan-assembler "bdnz" } } */
+/* { dg-final { scan-assembler-not "blt" } } */