Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp640038pxu; Tue, 1 Dec 2020 22:42:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxC3zObLumtkLn5sMJJY5YqSJj0r6VV06A0h12EQWD1CkDqIsD+qCCH6nQ5ycHUxo50Lgra X-Received: by 2002:a05:6402:b8e:: with SMTP id cf14mr1234985edb.86.1606891361269; Tue, 01 Dec 2020 22:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606891361; cv=none; d=google.com; s=arc-20160816; b=I4FeyNPcpfUQy42sJbz1tFcg8PPxj/YRK/2aihi/RBfKye8CQHjuUHouchFJ3ibx8m djttcDd3Un4OuIuNSQVGtEB+MRAhVJfTknLAzd9WXbZ+qRYILAz+Tnil9+d72grOVjP7 /BWZSxOLVEQ+UqjPeizRU1PBye8EegcHFjWzRlEVqdUuU7FE7qOFyLpT4WM5zlDzCWkk lsK122tMZgFCFo5qsMAIe0qdhxJcYvahBAzhTXcVePBSLCUMnNYcWHrS515EAazXuKfd TlaOf2o8kB/txrijHxAQwMQjtbDwhiZI6rk59cdwtOll88YWcGnBiOIe+HG8/Ac/NeiL SF1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=zL4mz76/y3ZXMgRwHXZFbRSThYi2xo3HwsAjR9gqvEA=; b=r3ygix4NEJp6MFmBedVLZVbIuKpHffArQfUmZeqIl5YtzwqsXEQvZTohRYmsDlq29G n1EyHuOKXPwbkJj8mfpztwhgF3U/oFvXeXKgjL0MBf4bfpewgGsMzzO6ytu8HJuhkOp3 JJcIC9TbeRwVL8OL56BH/ayb54MtlNWbx6AUl6N4ytK1j26E6nnxTfC2NpBr2g1swGAv LlpXj2VchbumGOpZ435Z7XDO8HA004WoDFBQA+iqE4yKOi1Je0Vps3NzVPA5sOMJ6jH0 s9Jp75/yCuEuLMJDJLxnb6WYUlm88j+1tOvrBf4l2sVhF1NxPS/tXlm/5i+JpfwIh4B9 1T9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm13si449819edb.281.2020.12.01.22.42.18; Tue, 01 Dec 2020 22:42:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387526AbgLBGix (ORCPT + 99 others); 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