From patchwork Fri May 3 18:35:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 241366 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 402992C00B5 for ; Sat, 4 May 2013 04:35:36 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=LFCW7XMYxIqRhJzcEB J0MfZP+R0Xbj3im2W972TfdAFfGHWpeNaeeXNw4jPVtGUbwzVPFfPp9E3RNCU8TX jGdVsV40aOXUqRjbKQYSBlKz5TOLXqmfXiEWGYvZ6qx0lQ/jl/sEb5k+P7isytYU /6SQ+48JHw+j5IAa+n814FK6A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=y0QTgNiTtI9wVbS/z3APnm0m 60s=; b=gavYmV0MMzzHJAUpZweVGtdezntRiqJMw6YY+ENNIXooI0SsSTc5y+ia ZgXf6gzDGGZF2ioVsxjExyZk+vRMO9qaoXZC0LsIVHDIe1OkuhLPurSzKerQ4ulP dpuN/bYRayiOM0/ywSFhyL213bMawFMryQisg4v+ycrp44yKrlw= Received: (qmail 4721 invoked by alias); 3 May 2013 18:35:28 -0000 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 Received: (qmail 4711 invoked by uid 89); 3 May 2013 18:35:27 -0000 X-Spam-SWARE-Status: No, score=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-qe0-f53.google.com (HELO mail-qe0-f53.google.com) (209.85.128.53) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 03 May 2013 18:35:24 +0000 Received: by mail-qe0-f53.google.com with SMTP id cz11so1073366qeb.12 for ; Fri, 03 May 2013 11:35:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=B61AhSkcEfWSxqMIUTsuVFV2yYnscVSPiEPr9DmZ2yI=; b=M4U2sU6gYhTlir8brJSeZdlle5yObYm7CBFIrfQfMhfNd12jxKQU6gbmBGveR3GwMU /hPJgRn3yQGwsfDb6O3gz9WxwLBY7ojf/AA6AJpWdX1D6cmao1DLTVziBOGZko184GHm W6+Nr0cxt/LnV+YycfMXpoYla9aGheKQmmZvjERGNE03OIA1mPVP4gSxp57oY/8uzT6Y YKBT+tnf6AshiyN/I0vfb3muxCB6WGC7aUE/gJulV/Q9sScPNh6+jxZsSePgqArWOViW fMaCjCyCbMGILPIPFx+zVYDxQBeZmYbWMu0heKbSxNTX9FajQUPjRomuRNI48GiIinYK HIBw== MIME-Version: 1.0 X-Received: by 10.229.151.3 with SMTP id a3mr5004828qcw.9.1367606122526; Fri, 03 May 2013 11:35:22 -0700 (PDT) Received: by 10.49.59.116 with HTTP; Fri, 3 May 2013 11:35:22 -0700 (PDT) In-Reply-To: References: <5183F345.3000906@redhat.com> Date: Fri, 3 May 2013 11:35:22 -0700 Message-ID: Subject: Re: [PATCH] Fix PR bootstrap/57154 (issue9179043) From: Teresa Johnson To: David Edelsohn Cc: Jeff Law , GCC Patches X-Gm-Message-State: ALoCoQkTe4a9T81fLV2UWB7Qv+UQtiDcp+6gv7Wc2iT3u/Sd/PIR7+1yms0g6u0/fIZLOCT5JDuG8Xkq8U//66TZ2BNyt4is48thN9mBM7SrSWT4QMQSoQ6fXUE4UYNCtUglLKjPs/4Xg02PbVaihjaDpqSoW0VptVZ3xBrKAxNXIPgiPqVVGKduNcDqJH/3n3T8LEg8YrDr Here is the patch with the new test case. Tested using dejagnu with and without my fix for PR57154 to confirm that it exposes the failure and works with the patch. Ok for trunk? Thanks, Teresa 2013-05-03 Teresa Johnson PR bootstrap/57154 * gcc.dg/pr57154.c: New test. On Fri, May 3, 2013 at 10:34 AM, Teresa Johnson wrote: > On Fri, May 3, 2013 at 10:28 AM, David Edelsohn wrote: >> On Fri, May 3, 2013 at 1:26 PM, Jeff Law wrote: >>> On 05/03/2013 11:15 AM, Teresa Johnson wrote: >>>> >>>> On Fri, May 3, 2013 at 9:37 AM, David Edelsohn wrote: >>>>> >>>>> Thanks for the patch. >>>>> >>>>> Bootstrap works on x86 and Anton's testcase works on x86. >>>>> >>>>> Is there any testcase for x86 that would demonstrate the failure or >>>>> that could check the probabilities in a dump file and see the >>>>> inconsistency? >>>> >>>> >>>> Patch is committed. But I just figured out why it isn't showing up on >>>> x86 - it is because -fschedule-insns is not enabled by default. I can >>>> reproduce it with x86 using the same test case. Will go ahead and >>>> submit a patch to add this to the testsuite. >>> >>> Just an FYI, we don't use -fschedule-insns (first pass) on x86/x86_64 due to >>> register pressure issues. However, I think for the testsuite it'd be OK to >>> have a test which uses -fschedule-insns to expose the need for clamping on >>> the probabilities. >> >> Then Anton's testcase would make a good addition, with explicit >> -fschedule-insns. > > Yep, getting that patch ready right now. > Teresa > >> >> Thanks, David > > > > -- > Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413 Index: gcc.dg/pr57154.c =================================================================== --- gcc.dg/pr57154.c (revision 0) +++ gcc.dg/pr57154.c (revision 0) @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fschedule-insns" } */ + +#define PF_FROZEN 0x00010000 +#define likely(x) __builtin_expect(!!(x), 1) + +struct cur +{ + unsigned long flags; +}; +struct cur *cur; + +unsigned long freeze_cnt; + +extern int foo(void *); +extern int slow_path(void *); + +static inline int freezing(void *p) +{ + if (likely(!foo(&freeze_cnt))) + return 0; + return slow_path(p); +} + +extern int blah(void); + +int testcase(int check_kthr_stop) +{ + int was_frozen = 0; + + for (;;) { + if (!freezing(cur) || + (check_kthr_stop && blah())) + cur->flags &= ~PF_FROZEN; + + if (!(cur->flags & PF_FROZEN)) + break; + + was_frozen = 1; + } + + return was_frozen; +}