From nobody Fri Dec 19 17:42:08 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1608247972; cv=none; d=zohomail.com; s=zohoarc; b=F4SHcFhYu8KjFBiOWzZGrUNiJYpeDJvxqY7CfofnK6+Z4IB0/mDprkOerilKZo0+e+greuh4DgkFQbq4MXd4XZYaU7xB/m0coLVLpxSj26+wLAi3y9TQEmE4amnCdNQ0FP9FVVPWidmS/38i6G6jAmljFzxM5I51dCsNiHFt1WQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608247972; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=awObaIaTJ+VwFn0hFkL6hs7ndK9WxTOtgurzy7OA2bcOc6CE2ay+iNiEh8yJxAu2gSJ6sOE208/mynmKin4pnByeQyvJUfjwybg8kXFeXTZI0FVXdz5xJ+q8NMQU9ojVocmtpevQdAhcXMwFsyXohJVuD9uZaWjUjtqF5M+Vflc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1608247972680915.4224347701279; Thu, 17 Dec 2020 15:32:52 -0800 (PST) Received: from localhost ([::1]:36706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpuxs-0006aW-6m for importer@patchew.org; Thu, 17 Dec 2020 10:13:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpudu-0003OE-Gc for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:35 -0500 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:41152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpudp-0004uv-Bm for qemu-devel@nongnu.org; Thu, 17 Dec 2020 09:52:34 -0500 Received: by mail-oi1-x229.google.com with SMTP id 15so32445855oix.8 for ; Thu, 17 Dec 2020 06:52:28 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id x130sm1136342oif.3.2020.12.17.06.52.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 06:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=Y45N7SZ/1G1wAVf4ie5dZ3ZzDQFp7nNKDtAwW0L8VeAu0tRCXRI0ojm4Y3xwTdwVZB AE1nBLiz+z6J/DnuU/WeZHo7jTlQcNIXXGE0yc35otugL8GlOz4Xv5DJ4q4eepx29wsg zzA7FfEFuqG/dFNbnCNxDfL5+WM25SOzIBzvLwfOoo+J/HndRB+jXXBr6OXwkRoJD3Ax /bOw+kgJgxV+TPgRHW8KWckuFCEDDVl2tsuh8Uva5F94Zm1iF7A0xRVTqRkkwSWguZtJ j7GSCHOpuAfZmPFWPso7o5ORgCC5OPLUl+I+Tf/oyZbR1SQbtvsLaE717WcyoypYFIDq sIVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x+s9W4S8X9df0AJnC/pFDE7SPPgT3/tOf2XSzgDEzSo=; b=tt8akvsWd6uNz7vSHsQqG3vt5Ab1sBOSMmyb6j7DUG58oP5Rc1VngN6K6tIo6fbNDz 2RSvzt+6jYmpelFQmLwFPg0TDnqJ+CLqybji8WXzknWO6vjeLu68rnhacHNg7i9rHF35 3wRkz4FyL3Um/BmLfJ0HG8HyrX3ORGLi0lLaOeO6mV2lKzcGkxZl+zqaP3yK4kerVLU1 fQv2hEJeCu+avgwUdfpLaT2hDfIusVY4dYmlUyYfQV4R4mOBFyKwejqDnDHjNrZdYbAe 2iSYOMRx1jo4kobpxLXN9plBVQmekrDFZ5c7bbO2A6Vj9yIkQodmnXYszSfABDKT70FN 8BRw== X-Gm-Message-State: AOAM533rLlcxqkphfOhrgIkF30ABX/ZQxgh0i/Qv9XFRlTZ0HrZC0bJM VlWFcI1XU37CTUP74hndxN0zgu0OtPVKBw+x X-Google-Smtp-Source: ABdhPJwhNhcff5pClGvzw2epjceNe7z6/RcbsGS35vo1tsV3rvKG25mpgV+u50A4JtwmZ8rsjWtN9w== X-Received: by 2002:aca:cc01:: with SMTP id c1mr5076799oig.18.1608216747597; Thu, 17 Dec 2020 06:52:27 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 09/23] tcg/optimize: Improve find_better_copy Date: Thu, 17 Dec 2020 08:52:01 -0600 Message-Id: <20201217145215.534637-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201217145215.534637-1-richard.henderson@linaro.org> References: <20201217145215.534637-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Prefer TEMP_CONST over anything else. Signed-off-by: Richard Henderson --- tcg/optimize.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/tcg/optimize.c b/tcg/optimize.c index c0fd65d2e4..bf2c2a3ce5 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -122,31 +122,28 @@ static void init_arg_info(TempOptInfo *infos, =20 static TCGTemp *find_better_copy(TCGContext *s, TCGTemp *ts) { - TCGTemp *i; + TCGTemp *i, *g, *l; =20 - /* If this is already a global, we can't do better. */ - if (ts->kind >=3D TEMP_GLOBAL) { + /* If this is already readonly, we can't do better. */ + if (temp_readonly(ts)) { return ts; } =20 - /* Search for a global first. */ + g =3D l =3D NULL; for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->next_c= opy) { - if (i->kind >=3D TEMP_GLOBAL) { + if (temp_readonly(i)) { return i; - } - } - - /* If it is a temp, search for a temp local. */ - if (ts->kind =3D=3D TEMP_NORMAL) { - for (i =3D ts_info(ts)->next_copy; i !=3D ts; i =3D ts_info(i)->ne= xt_copy) { - if (i->kind >=3D TEMP_LOCAL) { - return i; + } else if (i->kind > ts->kind) { + if (i->kind =3D=3D TEMP_GLOBAL) { + g =3D i; + } else if (i->kind =3D=3D TEMP_LOCAL) { + l =3D i; } } } =20 - /* Failure to find a better representation, return the same temp. */ - return ts; + /* If we didn't find a better representation, return the same temp. */ + return g ? g : l ? l : ts; } =20 static bool ts_are_copies(TCGTemp *ts1, TCGTemp *ts2) --=20 2.25.1