From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3406AC64E8A for ; Wed, 2 Dec 2020 06:39:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7F1520C56 for ; Wed, 2 Dec 2020 06:39:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387532AbgLBGix (ORCPT ); Wed, 2 Dec 2020 01:38:53 -0500 Received: from mga11.intel.com ([192.55.52.93]:42060 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387462AbgLBGix (ORCPT ); Wed, 2 Dec 2020 01:38:53 -0500 IronPort-SDR: qfPlIivmZ9R0/MiD3AMCBSg7SNhh5lZr5h5LcBFD9eViy/AhAPjhDRgnsgnCt+1audN/y0v6fZ cKfsTg59tC+A== X-IronPort-AV: E=McAfee;i="6000,8403,9822"; a="169459558" X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="169459558" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 22:37:00 -0800 IronPort-SDR: nhjfwl1wyrL9S96FyxTBjmLY2G1FXKobY8fNTUjclrSGlo7OUwSoPEOljhB2np9rjA0soeqm8k 8qCLpF4zA6lA== X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="549914773" Received: from tassilo.jf.intel.com ([10.54.74.11]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 22:37:00 -0800 Date: Tue, 1 Dec 2020 22:36:57 -0800 From: Andi Kleen To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, Jin Yao , John Garry , Paul Clarke , kajoljain , Stephane Eranian , Sandeep Dasgupta Subject: Re: [PATCH v4 5/5] perf metric: Don't compute unused events. Message-ID: <20201202063657.GC1363814@tassilo.jf.intel.com> References: <20201202062646.3780002-1-irogers@google.com> <20201202062646.3780002-6-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201202062646.3780002-6-irogers@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +| expr '-' expr > +{ > + if (!compute_ids || (is_const($1.val) && is_const($3.val))) { > + assert($1.ids == NULL); > + assert($3.ids == NULL); > + $$.val = $1.val - $3.val; > + $$.ids = NULL; > + } else { > + /* LHS and/or RHS need computing from event IDs so union. */ > + $$ = union_expr($1, $3); > + } Can't this be all in a macro? It's still a lot of duplication. I'm still not a fan, but I think with a macro it wouldn't be too bad. -Andi