From patchwork Tue Jul 13 16:09:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 58801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 048221007D4 for ; Wed, 14 Jul 2010 02:10:17 +1000 (EST) Received: (qmail 14365 invoked by alias); 13 Jul 2010 16:10:13 -0000 Received: (qmail 14355 invoked by uid 22791); 13 Jul 2010 16:10:11 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Jul 2010 16:09:37 +0000 Received: (qmail 24573 invoked from network); 13 Jul 2010 16:09:35 -0000 Received: from unknown (HELO ?192.168.2.3?) (sandra@127.0.0.2) by mail.codesourcery.com with ESMTPA; 13 Jul 2010 16:09:35 -0000 Message-ID: <4C3C8FC0.3040205@codesourcery.com> Date: Tue, 13 Jul 2010 12:09:36 -0400 From: Sandra Loosemore User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: PATCH: test case for PR39839 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The code size regression reported in PR39839 appears to have been fixed by a combination of r158189 (Carrot's patch for PR42601) and r162043 (the second part of my patch for PR42505). It seems worthwhile to add the test case so we can check that it doesn't regress and start generating unnecessary spills again. OK to check in? -Sandra 2010-07-13 Sandra Loosemore PR tree-optimization/39839 gcc/testsuite/ * gcc.target/arm/pr39839.c: New test case. Index: gcc/testsuite/gcc.target/arm/pr39839.c =================================================================== --- gcc/testsuite/gcc.target/arm/pr39839.c (revision 0) +++ gcc/testsuite/gcc.target/arm/pr39839.c (revision 0) @@ -0,0 +1,24 @@ +/* { dg-options "-mthumb -Os -march=armv5te -mthumb-interwork -fpic" } */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-final { scan-assembler-not "str\[\\t \]*r.,\[\\t \]*.sp," } } */ + +struct S +{ + int count; + char *addr; +}; + +void func(const char*, const char*, int, const char*); + +/* This function should not need to spill to the stack. */ +void test(struct S *p) +{ + int off = p->count; + while (p->count >= 0) + { + const char *s = "xyz"; + if (*p->addr) s = "pqr"; + func("abcde", p->addr + off, off, s); + p->count--; + } +}