From patchwork Wed Sep 4 10:50:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1980666 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=UqLDK+9X; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WzK6G30FXz1yXY for ; Wed, 4 Sep 2024 20:51:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DCCD13860C34 for ; Wed, 4 Sep 2024 10:50:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 9B7383858C98 for ; Wed, 4 Sep 2024 10:50:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B7383858C98 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9B7383858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725447040; cv=none; b=N/0UeoxPZXJMexk1p9DvtRdlrXmmU4JCczQWK5Hrd9Sfjs4vh74ekBfDckf7Fzx/VJgN98h4hdW5aLsP7QuAYa5yjXtRE3WJtYLBc4iiNvQP0Yk4UmgI10tCxMUskj5LghK5877IfkAlPzVJLYDL/o3sjQjED+e1WqoDlLj9Kvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725447040; c=relaxed/simple; bh=lSOuXMXAMUXkxD4I/z4H1+F7rVBYo5tWw7sKsMn7Jg0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=IHISacZ5pm0cEA0UFEI32UC0LfNplNFAyouN2dPUMtrI9qz5j6m9E/GgPSQgA6VxzT/3HeXG/fRA+lahAF+8CubKxO4QKGwuF24i+SXH7oY9RRzaTBRxGjMlsMpidxH9QDXM5Fj78jNj0888qZGrPSTE7QpmbPxn9MrER/eekDI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42c79deb7c4so33542725e9.3 for ; Wed, 04 Sep 2024 03:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725447037; x=1726051837; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=sk9Sx1nibNfN6Ip6emXfIKtMLNdAMi7tWVz2k8XPaIA=; b=UqLDK+9XtLpC9pKNx6pCG4SCc9U40y1mhtJRxvs6OtvyuaOlaZejYYvgZbc2LLNzlq pw/nqG34xhq/zaCftGTWX0jbJZ+tpeOBkWO5ACK6EejqRqeiXHkobNo23soeYEBwVAFK PoTbZ7HpgLeD16AA1x1lXzkfaRnsfCVyEjam8DB42lADl2Y6aAZvMRFv+Mu1C4AD1R/s g7r1RrFMik7FRklODOJ4ssAmtkb2fUbayuukb5/2xw5RFMKJR1OVszA76LWNu4GfQDyv d5IxrmO5bis3eqx+DDW4qbCEHYjyn2aVS7IDaZVjzIFf74/KgZFVeAegIPX20+eVDSUd A5kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725447037; x=1726051837; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sk9Sx1nibNfN6Ip6emXfIKtMLNdAMi7tWVz2k8XPaIA=; b=qFgZOMx/vMGigami6J5UnkQK1ClS4Ah0Hh+1I6TZDRJ+NCBT8azHVfznbOeIa7sT4J lE7hMT7GQEhIAd8t/d+ld9XtTNsv0vtEjICPBpa/v6xRqzePhsdZn+DWkaOdtdxowJEK TH2tcy2aSXbrx6c4jREPo4r6I9zRB80UpMnHAT4WUhGOtwNC4t+7GkODbtTp+HIMqq2R nthqvvQEhZmBK2+wVMrSt4QarrMh5w1JggA1a/gmVkNrE+24/sf51GGZI5hAUueMnPm2 vnbjYo8XkhO3Am6NY9o2yrIfzSfxKhVWnyCHZzvDYlLunEh4CvI7BhhqE5N4aMTd0Dbo nldQ== X-Forwarded-Encrypted: i=1; AJvYcCWIi7QiUEK8ezhO2Rhg3Sj6HFqgzoty/obYskpz/eTmOOAR+VAA8T5MXuVuN6hVjsWa0Dfyt4qGSI3s8g==@gcc.gnu.org X-Gm-Message-State: AOJu0Yyep83+ML8WVp8SZ47HlZ0UrBQJ9palYY2pYJl/FlVAGdGY6j2L X5boI6xNiV0hlQSZUSsgeoopXnpTv9gNyrB6xOu/wZrM0USPheuv5DHgV6Ggi4TOnDxZJOnf/IV N X-Google-Smtp-Source: AGHT+IEsZ/Hikt0+Dk+MhrqylAV4VkLxJ6j+xzYw1hAJ1AuoqHEeafPDCr1u+4yQZLACANFCW8p/6w== X-Received: by 2002:a05:600c:1c95:b0:426:64a2:5362 with SMTP id 5b1f17b1804b1-42c7b59e7dfmr87329415e9.8.1725447036942; Wed, 04 Sep 2024 03:50:36 -0700 (PDT) Received: from euler.schwinge.ddns.net (p200300c8b733b9005e8fc6f38b6af531.dip0.t-ipconnect.de. [2003:c8:b733:b900:5e8f:c6f3:8b6a:f531]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374c7fa443esm9195152f8f.41.2024.09.04.03.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 03:50:36 -0700 (PDT) From: Thomas Schwinge To: Jan Hubicka , gcc-patches@gcc.gnu.org Cc: Frederik Harwath Subject: Fix branch prediction dump message (was: Predict loops containing recursive call with fewer iterations) In-Reply-To: <20160626193656.GE75430@kam.mff.cuni.cz> References: <20160626193656.GE75430@kam.mff.cuni.cz> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.4 (x86_64-pc-linux-gnu) Date: Wed, 04 Sep 2024 12:50:27 +0200 Message-ID: <87o753y9os.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2016-06-26T21:36:56+0200, Jan Hubicka wrote: > this patch [...] > --- predict.c (revision 237789) > +++ predict.c (working copy) > @@ -3367,6 +3446,15 @@ pass_profile::execute (function *fun) > gimple_dump_cfg (dump_file, dump_flags); > if (profile_status_for_fn (fun) == PROFILE_ABSENT) > profile_status_for_fn (fun) = PROFILE_GUESSED; > + if (dump_file && (dump_flags & TDF_DETAILS)) > + { > + struct loop *loop; > + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) > + if (loop->header->frequency) > + fprintf (dump_file, "Loop got predicted %d to iterate %i times.\n", > + loop->num, > + (int)expected_loop_iterations_unbounded (loop)); > + } > return 0; > } ... has some in a strange order terms. ;-) Long ago, Frederik has fixed this (unfortunately only) on a development branch. As obvious, I've now pushed to trunk branch commit 35e4414bac06927387fb7a6fe10b373e766da1c1 "Fix branch prediction dump message", see attached. Grüße Thomas From 35e4414bac06927387fb7a6fe10b373e766da1c1 Mon Sep 17 00:00:00 2001 From: Frederik Harwath Date: Tue, 16 Nov 2021 16:13:51 +0100 Subject: [PATCH] Fix branch prediction dump message Instead of, for instance, "Loop got predicted 1 to iterate 10 times" the message should be "Loop 1 got predicted to iterate 10 times". gcc/ChangeLog: * predict.cc (pass_profile::execute): Fix dump message. Co-authored-by: Thomas Schwinge --- gcc/predict.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/predict.cc b/gcc/predict.cc index 43e3694cb42..f611161f4aa 100644 --- a/gcc/predict.cc +++ b/gcc/predict.cc @@ -4210,7 +4210,7 @@ pass_profile::execute (function *fun) sreal iterations; for (auto loop : loops_list (cfun, LI_FROM_INNERMOST)) if (expected_loop_iterations_by_profile (loop, &iterations)) - fprintf (dump_file, "Loop got predicted %d to iterate %f times.\n", + fprintf (dump_file, "Loop %d got predicted to iterate %f times.\n", loop->num, iterations.to_double ()); } return 0; -- 2.34.1