From patchwork Tue Apr 15 19:24:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 881313 Delivered-To: patch@linaro.org Received: by 2002:adf:f902:0:b0:38f:210b:807b with SMTP id b2csp636133wrr; Tue, 15 Apr 2025 13:03:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVGrLqDF8Vgo7iDQNQcGg/je5vWggoNwmI9thEn/e9UGJrYouw9LJdbnw0zD8LWFxwV8QcV+A==@linaro.org X-Google-Smtp-Source: AGHT+IEy4dP0Wwd+hejusududHU/xNXWWTLPxBbLmVwThtu7lIxBN/Q6trtF4hvhA+wW3zs8Rvex X-Received: by 2002:a05:6214:258e:b0:6e8:9a55:8259 with SMTP id 6a1803df08f44-6f2ad84b070mr14763166d6.9.1744747395312; Tue, 15 Apr 2025 13:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744747395; cv=none; d=google.com; s=arc-20240605; b=POO18uoS39WUopoLjDA8mxOdNO6P2VE+XIDS1xzB4ZXsKALTEcSrYTZ58c8QR6WwCw J2x3/Kds+cW7Onz+tunsdeUYAkS08bLlS05V6r9dBTxCPTxyQHObGizn8rUkD7wWMbot ILqKO3RIe3vQlgxFVtqW7AsuRiRYj7KlzfYrMlwmBudg9iQrP+9VxUenTjiLlmcr24NP eOG0AEJ3YxmLXiIHXAeimcPsjc6QfL02XhPxR9HBBNH9x9LqM0Or9S+Ya9AZuzOWiLN2 86sH2a+icyaDwgwHXRm7roMJBc3p1gf9T8c+cJJj2jGtHnpFxFbGj6WacczazUM6P69y 1VIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=+auAC/0fVNtyUj9IXA1C/8l+Sur9fbt7QCSiCH6lOqc=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=UfVAqhXy8ohCQH7tUfe+oRctIjMccE8PojJJk1zQoLhH/VVRoebwhoTbefQoHSvfEY pVsrCbg855ZPkDtUs6mZBSQn9M8KTKjIqioYd0nvL+ZMk9QcSXYDpvf17rmlsjDel8cD t2Ord13O0Fn9Hrn0OV0gH8dCR6ukrb3mQ9Wd5Vd9uTMUZKjj/X1C/oyZo1g5X6S72jSc OG9xy2IxzUSrNL4VIsx1Eaa5vtzfUoJhxYKaaA89cIZ11xFkmZRxhnsuK0pgF0UQ53k6 03R8s0TwnK92AOTkTCTmuZ8uFF7Oj2WbmcwwQsRDFbERY8Gb421QKRvJ1Bp9aj7GfMhx 6HMQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l/qDztFp"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6f0de9dca91si131303016d6.262.2025.04.15.13.03.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Apr 2025 13:03:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="l/qDztFp"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u4mGU-0001ET-Ju; Tue, 15 Apr 2025 15:48:16 -0400 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 1u4mAo-00071T-3k for qemu-devel@nongnu.org; Tue, 15 Apr 2025 15:42:23 -0400 Received: from mail-oi1-f180.google.com ([209.85.167.180]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u4mAA-0007BE-4P for qemu-devel@nongnu.org; Tue, 15 Apr 2025 15:42:14 -0400 Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3feb0db95e6so3810949b6e.1 for ; Tue, 15 Apr 2025 12:41:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1744746064; x=1745350864; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+auAC/0fVNtyUj9IXA1C/8l+Sur9fbt7QCSiCH6lOqc=; b=l/qDztFpY7X3orh+3+YB6laVBDVxwaejsKVw32Jwc1sO3134e1YCxtmg9/kuxQCtbp OBsi2HxhsWBh7CU2klPfHnypdJAbMqAOzljrccqttHPr4bffA5lh1Sla4xDv07UE5fE1 R/FjNnd1Nw2JHmToQnmLLauC0n3p2JqSnV09GWSG5m1RBqzlQmBN35twiJqlB043TkrY 22qWXCpu2/FepaoCpXoDfzQ7jRNR/bT5upS6hu3Crnt6X1oqzcBe9Grmzf2wyUrbc5pk 1qWJNPQ7VG1RO0O1dwCmysZrcU64g/Jcd4XAYaSeF7hryydaJY7so/FiVtMMPT2gUWcI 0vew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744746064; x=1745350864; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+auAC/0fVNtyUj9IXA1C/8l+Sur9fbt7QCSiCH6lOqc=; b=NIxBvTJ2+8wNWvsEYAYqDRfSSEPmzguHWsoK03G6rbQ94sG5upuaS5Xe0GCeZgmHOD LOSbt3jiiJorN9+z9XLzubkXJqqd31uic3WIHD6CGo+tZMTjAjj6NkQcncq5btpxr6p0 YRkDGPxCQjNJ1mYZO4FpERgMRlOyvfootlwsxldllK+m5zkGiq3N9/G5YimU6rakLbNo tY7335fJu9IgVu5T/AdF/TB4bBaWHsGzCEWa9Rz21kwY/rGiFlrHjGNyetmbvqLx6/gK /MAgD9o1QuI8xDBaj+ioBx3ADWFf8CjsfcVklld4cdK8Us8eWmIUp17juUeYWlLcWk07 MnhQ== X-Gm-Message-State: AOJu0YwikC/zUO/sHKZZnFaLFL38BetsVcIFwV6YIVIehbGof/ICjhoe MmBMrJ5YumK6rp9mI8X6MPt5kfJNsSpdGDQZwD/ZwGk3TPdbbk9sGMi8t6Wywdef96yvO0+j5hs u X-Gm-Gg: ASbGncuyJ1wqtKrVCmcFl8ffGimnR9veB7YgIMOcO6LIf7gzqWCtgV/sUkZhMM3Vnwc yQyRyEhSbbvri1TKCg7MNCOZo3qep/zXNSS/H6PvlW65SbLi3i41hbxZcwrjztmCSIbmgmOOAZz saCdjGyqTzI0TTeLWbZFa3TIB6EJ8R3mGgkFrrUZ+ZXV96nLuqCfoaEEi/H9u3NWewPp2a+ySxh EpdGjVoufkuvf8ax7Y+C2T3M62ZrQdxd95jzlwohzIUnBzNaR8tf/PJQl3uEMe6jlfPKdjdYCbG mnjdfdeiNTsKqDA5UqZnjkDtyRlny32x8y5oFEy1mJpuTPq2DPY45tRIbYewmYg0g1VB08ZrgAo = X-Received: by 2002:a17:903:228e:b0:223:66a1:4503 with SMTP id d9443c01a7336-22c31a6e008mr5350015ad.30.1744745570468; Tue, 15 Apr 2025 12:32:50 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22ac7ccbd5esm122062355ad.248.2025.04.15.12.32.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Apr 2025 12:32:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 112/163] tcg: Sink def, nb_iargs, nb_oargs loads in liveness_pass_1 Date: Tue, 15 Apr 2025 12:24:23 -0700 Message-ID: <20250415192515.232910-113-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250415192515.232910-1-richard.henderson@linaro.org> References: <20250415192515.232910-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.167.180; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-f180.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, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Sink the sets of the def, nb_iargs, nb_oargs variables to the default and do_not_remove labels. They're not really needed beforehand, and it avoids preceding code from having to keep them up-to-date. Note that def was *not* kept up-to-date; thankfully only def->flags had been used and those bits were constant between opcode changes. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- tcg/tcg.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 9da6c8bb4d..381e76cfc8 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -4071,8 +4071,6 @@ liveness_pass_1(TCGContext *s) case INDEX_op_sub2_i64: opc_new = INDEX_op_sub; do_addsub2: - nb_iargs = 4; - nb_oargs = 2; /* Test if the high part of the operation is dead, but not the low part. The result can be optimized to a simple add or sub. This happens often for x86_64 guest when the @@ -4087,8 +4085,6 @@ liveness_pass_1(TCGContext *s) op->args[1] = op->args[2]; op->args[2] = op->args[4]; /* Fall through and mark the single-word operation live. */ - nb_iargs = 2; - nb_oargs = 1; } goto do_not_remove; @@ -4100,8 +4096,6 @@ liveness_pass_1(TCGContext *s) opc_new = INDEX_op_mul; opc_new2 = INDEX_op_muluh; do_mul2: - nb_iargs = 2; - nb_oargs = 2; if (arg_temp(op->args[1])->state == TS_DEAD) { if (arg_temp(op->args[0])->state == TS_DEAD) { /* Both parts of the operation are dead. */ @@ -4122,19 +4116,15 @@ liveness_pass_1(TCGContext *s) goto do_not_remove; } /* Mark the single-word operation live. */ - nb_oargs = 1; goto do_not_remove; default: - /* XXX: optimize by hardcoding common cases (e.g. triadic ops) */ - nb_iargs = def->nb_iargs; - nb_oargs = def->nb_oargs; - /* Test if the operation can be removed because all its outputs are dead. We assume that nb_oargs == 0 implies side effects */ - if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && nb_oargs != 0) { - for (int i = 0; i < nb_oargs; i++) { + def = &tcg_op_defs[opc]; + if (!(def->flags & TCG_OPF_SIDE_EFFECTS) && def->nb_oargs != 0) { + for (int i = def->nb_oargs - 1; i >= 0; i--) { if (arg_temp(op->args[i])->state != TS_DEAD) { goto do_not_remove; } @@ -4148,6 +4138,10 @@ liveness_pass_1(TCGContext *s) break; do_not_remove: + def = &tcg_op_defs[opc]; + nb_iargs = def->nb_iargs; + nb_oargs = def->nb_oargs; + for (int i = 0; i < nb_oargs; i++) { ts = arg_temp(op->args[i]);