From nobody Wed Nov 27 11:56:12 2024 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=1699325708; cv=none; d=zohomail.com; s=zohoarc; b=F/raWextRuYBBl0cToKi1zHppCDb6vyCKWQWhyoxY/of2W631AjLyv9mtg7dXnDgZjXy/6yO6IUVCGFe5koIem2nXrAookaXsQBH3GO6Kr9nECDTQ6AX9gokq1mIzH5U5IzAWHNfHkQ4MXoDRhQzRRQbxdo4FGPAFGNexhUiGyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699325708; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; b=KFRyEzgRmCwmV3Pn7lOE8DvIOFAhgkrma32fsSgmXTxIg/uQ7y7Qhd0n2A3ABnV/BxPni+st2jvKvz/iPPM4pNdSf28ML6trc5mqdgfOQ3pbXwk+LH/c4xo6JrqM7kj6BZ7sk1LD95K0ew8P00OceqfOcV5Q9pJV2DPsxlQqpzo= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1699325708423945.9467661863121; Mon, 6 Nov 2023 18:55:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r0C9R-0008R4-8m; Mon, 06 Nov 2023 21:49:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r0C9O-0008Px-M4 for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:10 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r0C9N-0005wD-6S for qemu-devel@nongnu.org; Mon, 06 Nov 2023 21:49:10 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5aa481d53e5so3493134a12.1 for ; Mon, 06 Nov 2023 18:49:08 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id fn11-20020a056a002fcb00b006bff7c36fb3sm6367478pfb.95.2023.11.06.18.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 18:49:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699325348; x=1699930148; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; b=F3qk9MDBWiSLhGogYwZbW8/9VAAYs6ZyNRzuqXuOxsqN+IKGfUST2rqiyp+jjNb5Hc MHzkXtPzHIhSD+LKsYFVDCRdHhDpTZxqNef3yDBtbpIbyOUVPinPhTOh1jTvfye3a41O gMU5QPjwoUC6BTwLvi5fe+b8uEuHdbTv9qNUgB0FkRaEuXgp+X7N1LXMBLYX8byCRfEH Jwp5lFhez+cy0FWaMLhIShrmXy7bh98a032zIRGH7TuW/wJFZVRkttjyorc6vRkX2mVJ cGdDLvTF3MyEjs3rqaV/X9xV/w7GaZ8+gdju3YPP/fVkPyjitae0I2TMLU7m6Yhxz89I RYUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699325348; x=1699930148; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s0FKOVu2Ee6DzcvywhcOLuTknlnZxj3uQnWlPfBTRpM=; b=WLymSZPwV5bPx/SguGFwCIddHsP/YAVzXoFYLxxJazpDmHsiHzKeKYz843+7sa0t39 rvMgcfvWKmU3K+RRq7A5jPWwlydFDeYfhYjQcQB5dvTAEUcWqlR7EOBjglv6nxPSr2PF LytdbtSdAFgoMKMosu/Cx1mNZjXmFXE8w14prqdDYs73yTS+0RlGu670yUWAGr5ROs/A OaHXIUxkJ1yipyrEkjbsE1wEG6JhVSaG0+C85k+LJNpQdPMXxzpMUFkYvQHQ9b1iQdfv 7ap5SBSht6hvlmR93JlA2Jh0NkQnjeq32un2goHc2UDVDe2o8ushoIQEjh9C5lzN74mf jKKg== X-Gm-Message-State: AOJu0YyXiU9isym6YFX5cSFJTCpXe/mzqJ4veHKEDfWm/wMSAhxTUK3e gLGU89nnQVUyBlYTtCWAThxObQjp7mzjM6dGCtE= X-Google-Smtp-Source: AGHT+IGYPGlOW0608BMVebjVjUyPRJXbrZBVq+98Ra/ROD7r4ExQ0bgig97y8m6PcsthjExDsUFPYA== X-Received: by 2002:a05:6a20:431c:b0:181:9b65:b4b5 with SMTP id h28-20020a056a20431c00b001819b65b4b5mr12031555pzk.3.1699325347936; Mon, 06 Nov 2023 18:49:07 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Song Gao Subject: [PATCH 30/35] tcg: Eliminate duplicate env store operations Date: Mon, 6 Nov 2023 18:48:37 -0800 Message-Id: <20231107024842.7650-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231107024842.7650-1-richard.henderson@linaro.org> References: <20231107024842.7650-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::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1699325709052100005 Content-Type: text/plain; charset="utf-8" Notice when a constant is stored to the same location twice. Reviewed-by: Song Gao Signed-off-by: Richard Henderson --- tcg/optimize.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index b32ef0be0f..a4fe9ee9bb 100644 --- a/tcg/optimize.c +++ b/tcg/optimize.c @@ -2269,6 +2269,19 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCG= Op *op) src =3D arg_temp(op->args[0]); ofs =3D op->args[2]; type =3D ctx->type; + + /* + * Eliminate duplicate stores of a constant. + * This happens frequently when the target ISA zero-extends. + */ + if (ts_is_const(src)) { + TCGTemp *prev =3D find_mem_copy_for(ctx, type, ofs); + if (src =3D=3D prev) { + tcg_op_remove(ctx->tcg, op); + return true; + } + } + last =3D ofs + tcg_type_size(type) - 1; remove_mem_copy_in(ctx, ofs, last); record_mem_copy(ctx, type, src, ofs, last); --=20 2.34.1