From patchwork Mon Mar 11 09:05:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1054246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-497659-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44HsdB0TtBz9s3l for ; Mon, 11 Mar 2019 20:05:16 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Vi4lbhoIG9w+KwuJ sEYCYnDlUhGlOrsTeiRTQ4ReRAxKxKc1DshYGeLJvWYqmSXuUagyLIlTnJp9jSDc VXSp+U3nNQ4T9k2gbNkXrxXCcpSv0CgkKL/M5gK23lSWU7vt7g06w++9gO+rnfi3 pR7bmySNOe3NEczvOO+/zbBqE68= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=Nsx1UVXF+yTi7+DV1TEXEp 53zDk=; b=KednipHNpV4dH/cpGtrPcpQoCKRLNx9zxdfhjhSwb8LF4l36HhJuJV vDk5FkQs55S9YfNtWmAkVxLoF47jNhBA9cHBUVwzC73UnA78LDRSEXJAAs8Hss8/ W/n1aR4LYpn/RoPWQgb+BzeWp4yEai/7ryB0szq0t/clpuGJgFb8M= Received: (qmail 51752 invoked by alias); 11 Mar 2019 09:05:08 -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 51738 invoked by uid 89); 11 Mar 2019 09:05:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=269546, dg-warning, dgwarning, H*MI:polaris X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Mar 2019 09:05:07 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C0EEE8138E for ; Mon, 11 Mar 2019 10:05:04 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3zI_lPchDrrA for ; Mon, 11 Mar 2019 10:05:04 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 9A8DC8138B for ; Mon, 11 Mar 2019 10:05:04 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix PR rtl-optimization/89588 Date: Mon, 11 Mar 2019 10:05:02 +0100 Message-ID: <1749039.2VBSkXCst6@polaris> MIME-Version: 1.0 Hi, this is the failure of the assertion: /* Should not get here (such loop should be peeled instead). */ gcc_assert (niter > max_unroll + 1); in unroll_loop_constant_iterations on a testcase both containing #pragma GCC unroll and compiled with -fno-tree-loop-optimize. The proposed fix is just to disable the pragma altogether when the option is passed. Tested on x86_64-suse-linux, OK for mainline and 8 branch? 2019-03-11 Eric Botcazou PR rtl-optimization/89588 * tree-cfg.c (replace_loop_annotate_in_block) : Skip annotation and warn if -fno-tree-loop-optimize is specified. 2019-03-11 Eric Botcazou * c-c++-common/unroll-6.c: New test. Index: tree-cfg.c =================================================================== --- tree-cfg.c (revision 269546) +++ tree-cfg.c (working copy) @@ -280,9 +280,16 @@ replace_loop_annotate_in_block (basic_bl loop->safelen = INT_MAX; break; case annot_expr_unroll_kind: - loop->unroll - = (unsigned short) tree_to_shwi (gimple_call_arg (stmt, 2)); - cfun->has_unroll = true; + if (flag_tree_loop_optimize) + { + loop->unroll + = (unsigned short) tree_to_shwi (gimple_call_arg (stmt, 2)); + cfun->has_unroll = true; + } + else + warning_at (gimple_location (stmt), 0, + "pragma GCC unroll disabled by " + "-fno-tree-loop-optimize"); break; case annot_expr_no_vector_kind: loop->dont_vectorize = true;