This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 6/6] combine: allow combining two insns into two in some cases (PR52714)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 2 Dec 2014 19:11:04 -0600
- Subject: Re: [PATCH 6/6] combine: allow combining two insns into two in some cases (PR52714)
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1417135737 dot git dot segher at kernel dot crashing dot org> <5030840454fd7bbd071e868121a946eaa3e03338 dot 1417135738 dot git dot segher at kernel dot crashing dot org> <547CA7EE dot 6040809 at redhat dot com>
On Mon, Dec 01, 2014 at 10:39:58AM -0700, Jeff Law wrote:
> Also OK with a testcase. I'd recommend just using the one from 52714,
> make it m68k specific. Not sure if it's best to scan the assembly or
> .combine dump -- your call.
Here is the testcase. I cannot actually test it on an m68k build, should
really do something about that (I build lots of cross compilers but they
cannot run the testsuite). Does it look okay, can you test it yourself?
[I did of course test the generated asm is indeed okay; just cannot test
the dejagnu stuff].
Segher
2014-12-02 Segher Boessenkool <segher@kernel.crashing.org>
gcc/testsuite/
PR rtl-optimization/52714
* gcc.target/m68k/pr52714.c: New testcase.
---
gcc/testsuite/gcc.target/m68k/pr52714.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/m68k/pr52714.c
diff --git a/gcc/testsuite/gcc.target/m68k/pr52714.c b/gcc/testsuite/gcc.target/m68k/pr52714.c
new file mode 100644
index 0000000..0a52a1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/pr52714.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/52714
+
+ Check that combine manages to remove the "stack == 0" test.
+ Without ICEing. */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int __re_compile_fastmap(unsigned char *p)
+{
+ unsigned char **stack;
+ unsigned size;
+ unsigned avail;
+
+ stack = __builtin_alloca(5 * sizeof(unsigned char*));
+ if (stack == 0)
+ return -2;
+ size = 5;
+ avail = 0;
+
+ for (;;) {
+ switch (*p++) {
+ case 0:
+ if (avail == size)
+ return -2;
+ stack[avail++] = p;
+ }
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-assembler-not {\mtst\.l %sp\M} } } */
--
1.8.1.4