From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89662 invoked by alias); 12 Apr 2018 08:02:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 89593 invoked by uid 89); 12 Apr 2018 08:02:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_2,GIT_PATCH_3,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=nonNULL, non-NULL X-HELO: mail-lf0-f51.google.com Received: from mail-lf0-f51.google.com (HELO mail-lf0-f51.google.com) (209.85.215.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Apr 2018 08:01:58 +0000 Received: by mail-lf0-f51.google.com with SMTP id q9-v6so6337588lfk.9 for ; Thu, 12 Apr 2018 01:01:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hrzEalMb9pMeGnW00kgIJ+aH8CCfMd50sSrvbacWo/o=; b=tHa3SQ+VthNXkFOVVU5kUeUOTtWhkZFK1wSY3Ffg9ze/GlV5KAeH/kB0l2ohy7SLHY dTD5ug+SRkq/PANPFkjzIeZjqwesji0oiRT7DbfMdkF6PDvZgXxA8BW/EwaoqvE2U4vD vNfQnuTVaDAmiuwjXuL1sUWEhO0Eg/dpBTFRdM6Lq9myCg2/Ys6YlaBg6tZjhlR0LZrE 8N1Oj6l3amekKe+awyTu9ldUbx9cnWJ/vInY3epTmb5D1/+s7tQGpNJSupdfxLNUKEPs bkLGotRrrJKMj+FPNullI1sKNQk9dZ2v0edPw2+ghuKGHoa89S0wBpVCESkCMv/Hq22E 7zaA== X-Gm-Message-State: ALQs6tDU8WIKw6JiMqjyStB+zZeNnaNiwFkOe4wABH38DAKZ5HHaXGDu Hca6AZh6zGfYfqw3KLk6pYt5IexVo8CPje1WTkE= X-Google-Smtp-Source: AIpwx499BdQkyeW9KqjaYZnejnwc4zuV28TAF4uyA3pwr5cVGltQ6Kt7NnDSLnqjF0JGIyZ4/1SbsFHga+kJX/cwB3s= X-Received: by 2002:a19:e112:: with SMTP id y18-v6mr4692858lfg.102.1523520116351; Thu, 12 Apr 2018 01:01:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.66.218 with HTTP; Thu, 12 Apr 2018 01:01:55 -0700 (PDT) In-Reply-To: References: <20180406141029.GF8577@tucnak> From: Richard Biener Date: Thu, 12 Apr 2018 08:02:00 -0000 Message-ID: Subject: Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 To: Cesar Philippidis Cc: Richard Biener , Jakub Jelinek , "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-04/txt/msg00579.txt.bz2 On Wed, Apr 11, 2018 at 9:30 PM, Cesar Philippidis wrote: > On 04/09/2018 04:31 AM, Richard Biener wrote: >> On Fri, 6 Apr 2018, Jakub Jelinek wrote: >> >>> On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: >>>> 2018-04-06 Cesar Philippidis >>>> >>>> PR middle-end/84955 >>>> >>>> gcc/ >>>> * cfgloop.c (flow_loops_find): Add assert. >>>> * omp-expand.c (expand_oacc_for): Add dummy false branch for >>>> tiled basic blocks without omp continue statements. >>>> * tree-cfg.c (execute_fixup_cfg): Handle calls to internal >>>> functions like regular functions. >>>> >>>> libgomp/ >>>> * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. >>>> * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. >>> >>> I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to >>> mention that: >>> >>>> --- a/gcc/tree-cfg.c >>>> +++ b/gcc/tree-cfg.c >>>> @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) >>>> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) >>>> { >>>> gimple *stmt = gsi_stmt (gsi); >>>> - tree decl = is_gimple_call (stmt) >>>> - ? gimple_call_fndecl (stmt) >>>> - : NULL; >>>> - if (decl) >>>> + if (is_gimple_call (stmt)) >>> >>> This change doesn't affect just internal functions, but also all indirect >>> calls through function pointers with const, pure or noreturn attributes. >> >> I think the change is desirable nevertheless. The question is if we >> want to do it at this point in time. >> >> The description of the problem sounds more like LTO writing writing out >> loops without previously fixing up state. So sth like the following >> which I'd prefer at this stage (the above hunk is ok for stage1 then). > > OK, I'll save that hunk for stage 1. > >> Index: gcc/lto-streamer-out.c >> =================================================================== >> --- gcc/lto-streamer-out.c (revision 259227) >> +++ gcc/lto-streamer-out.c (working copy) >> @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod >> /* Set current_function_decl and cfun. */ >> push_cfun (fn); >> >> + /* Fixup loops if required to match discovery done in the reader. */ >> + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); >> + >> /* Make string 0 be a NULL string. */ >> streamer_write_char_stream (ob->string_stream, 0); >> >> @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod >> streamer_write_record_start (ob, LTO_null); >> >> output_cfg (ob, fn); >> - >> - pop_cfun (); >> } >> else >> streamer_write_uhwi (ob, 0); >> >> + loop_optimizer_finalize (); >> + pop_cfun (); >> + >> /* Create a section to hold the pickled output of this function. */ >> produce_asm (ob, function); > > That worked. Is this patch OK for trunk, GCC 6 and GCC 7? Ok if you remove the cfgloop.c hunk. There's no point in an assert of sth being non-NULL when the immediately following stmt will dereference it. You get an ICE anyway. Thanks, Richard. > Thanks, > Cesar >