From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 4FB853858D38 for ; Mon, 11 Sep 2023 20:31:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FB853858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-99bcc0adab4so616112866b.2 for ; Mon, 11 Sep 2023 13:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694464316; x=1695069116; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=1YpHA5Rq0Uo7LncSTrclkDZh5FNUwlNORpU83GHc9hY=; b=AwdVzd+0K//0NxQsC3nBxxXItRkm5cyXioHRrVjknahnQZlUCvCESJrFTjR7aa2XLR Kc0fjKgYq6+kl2jQj/QbSBec+qqfhw6YLvCmN0n2GLKuisOCPCxLm7dAZssrlJE2KhKX EPrmXYgYi5L5oiQZ1XM7Q6TbbexlSLoV6vw6d/aYf6c+TgF4lcCL5oPSfqz2Dn+qr2b8 7PlVKUQONjtVel7/yv04Pm+ZQZ+DXt7rAgtqC2IIlD0cFvflaVgVd+ApI0mTPrXImDmU kiKXkkcH4KPqjuaCtgN3HSr5hPtRfWBmFCu7w94wRUJFZF7yDWH0QIVgN8koZDidds0H VSOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694464316; x=1695069116; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1YpHA5Rq0Uo7LncSTrclkDZh5FNUwlNORpU83GHc9hY=; b=ZLnoafRPMZavgI18IpYNVFWubCHGzbgRkROx/UXv5Y7Um2OMXHCn04IWoKTJRLBC8z wSZ3GPtf1AEgUcqxH7wLXnJUyKycjLKvwzVsXYwl7QLp4s986gN86dlgumEnEqESUxkd HixTOB/Oikh8Smb6NAXfHpueJrQAgBXyEWPE9Ng30dwifh4BOjcuMJrQpRTSrZ+BZXLm DlVeVJSSfk+RiXrnd4lgNg8uD1u9Txw8/9wjG0ILHCUmTA1qwcKN2iYtRpXLAUW+9dz7 oxbblJMbybTxVX7yGZp+0ce6WI71qfNloKLMyot52d41TrFAH5D1O/oWIB5jbMZKtELD zGLQ== X-Gm-Message-State: AOJu0Yw1HJxF52ZmFHgX4P+SyTlxCDwkaF/hHogA/aN4ecXTAqNQJYcn CVM0Iaqk6s4geIEK40Vm4sQ= X-Google-Smtp-Source: AGHT+IGfPMtwBAm66vYoPDYsUHXwGwnHCCIbwuopjj518KlK8skyP1rOxCiiwoeTHVWytJGSKIC04A== X-Received: by 2002:a17:906:21b:b0:994:522f:3f4a with SMTP id 27-20020a170906021b00b00994522f3f4amr9864322ejd.29.1694464316330; Mon, 11 Sep 2023 13:31:56 -0700 (PDT) Received: from [192.168.1.24] (ip-046-005-130-086.um12.pools.vodafone-ip.de. [46.5.130.86]) by smtp.gmail.com with ESMTPSA id p9-20020a17090635c900b0099bccb03eadsm5771675ejb.205.2023.09.11.13.31.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Sep 2023 13:31:56 -0700 (PDT) Message-ID: <88532fc5-a5fc-d725-c377-92b639c1e256@gmail.com> Date: Mon, 11 Sep 2023 22:31:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: rdapp.gcc@gmail.com, kito.cheng@gmail.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com Subject: Re: [PATCH V3] RISC-V: Support Dynamic LMUL Cost model Content-Language: en-US To: Juzhe-Zhong , gcc-patches@gcc.gnu.org References: <20230911094107.3342788-1-juzhe.zhong@rivai.ai> From: Robin Dapp In-Reply-To: <20230911094107.3342788-1-juzhe.zhong@rivai.ai> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Juzhe, glad that we can use the dominator info directly. Could we move the calculation of the info to the beginning (if it's not available)? That makes it clearer that it's a prerequisite. Function comments look good now. Some general remarks kind of similar to v1: - I would prefer a hash_map or similar to hold the end point for a range instead of looking through potentially all ranges in contrived cases. - As long as we're just looking for the maximum number of live registers, we can use a sliding-window approach: create a structure with all start and end points, sort it, and increase the current pressure if we start a new range or decrease. That's O(n log n). > + const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (t)); > + const ssa_use_operand_t *ptr; > + > + for (ptr = head->next; ptr != head; ptr = ptr->next) > + { Why does FOR_EACH_IMM_USE not work here? > + unsigned int max_point > + = (*program_points_per_bb.get (e->src)).length () - 1; > + for (k = 0; k < (*live_ranges).length (); k++) > + { > + if ((*live_ranges)[i].var == def) Would also be nice not having to search through all ranges but just index/hash it via var (or similar). What about one test with global live ranges? Not a necessity IMHO we can still add it later. Regards Robin