From patchwork Sat Dec 7 21:47:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 848109 Delivered-To: patch@linaro.org Received: by 2002:a5d:50c2:0:b0:385:e875:8a9e with SMTP id f2csp1431967wrt; Sat, 7 Dec 2024 13:47:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU+a5bGq+4QnAAl4xHTM85rnPIhlwwRA5MgIf2wXil62xdBVQdAHvCbf6GcxnQFnllCwEvCtQ==@linaro.org X-Google-Smtp-Source: AGHT+IE7dGhcSBXU+40HCvNUs5GgSMSJDhKAP4KAUUXtTxqxux+oIiCgnDK5uZae3vwGJRADKnbp X-Received: by 2002:a05:620a:27cd:b0:7b6:c6f8:1d2f with SMTP id af79cd13be357-7b6c6f81f1emr526229685a.30.1733608070727; Sat, 07 Dec 2024 13:47:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733608070; cv=none; d=google.com; s=arc-20240605; b=VMj52lEfgo9yq8ZkivhGAZaZV5tKOqLjRaWWqwbkcYei1eXHk2XuF/J0FJrJy57mFI qejZ8ctCiR4AXB9Q54ie1Msnb2pAU2KiEvRrxRkKKUccIhFlRNdTyY8/EGaZmvqw7m9l msW2w80bhykjrVovatwKbLu213mspXN0NMVYPEgwf8kWrCsB6Anwti7OYOzBaf1G1ljn AI0lIaCZgPBtXfmlh4o58sjwr4DuvZM6gEEJPh43gB6bp3Z+AghBtIOP/fBd22ELiFty ZuwxhNa1El3JjTaEW8KLkLmc9rQ0ZlIWIJLWropgug87zip92ndbS3m0J2b/sEfBsCOO TVIg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=LcEsBkOR0IXFp+TmHIgG4yNI7CI4TTQsI2n7XV4yepw=; fh=Nb2QPNoJzJZJG6J7IFS1Vsq6WDyV+DEsG/zFXmsdQfc=; b=UGJRYDtvNTMsgPyRbbby1ElLxGeyKpzI5IlPkOUcxoTcy+ZJ7GgMSctK+A+mSDprSA 2WnWkP3ZAl9LxlBVrl6uY4ccLdkEh1F7qgQvvqgwdIkn1ojIkfmePyDVhwi19NxkG42m DQ5iB7qA/1x/iOIyDS/p3yOYt5siYpGlBVXKr+qr0Koyul8lx9zaHoFA69SvtClgZTxO aj+otO/tKSwB3RyJ7kEAzZ1U6G7ovSJvWa8PMoTrdzIBz5pVu42DRxazWbEkU44C6P7a 0awtqMJWR5zJ7XSZxXzEOPUbBwsDCyorc3PmH5/j2mI3V41Qz183rmBLN1m+mMKinxnD tUhA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G3oDklOz; 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 af79cd13be357-7b6b5a46758si777010785a.57.2024.12.07.13.47.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Dec 2024 13:47:50 -0800 (PST) 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=G3oDklOz; 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 1tK2do-0000Ju-M6; Sat, 07 Dec 2024 16:47:08 -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 1tK2dm-0000Jc-N1 for qemu-devel@nongnu.org; Sat, 07 Dec 2024 16:47:06 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tK2dk-0004cc-Oq for qemu-devel@nongnu.org; Sat, 07 Dec 2024 16:47:06 -0500 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-71d4032b3e9so2214608a34.1 for ; Sat, 07 Dec 2024 13:47:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733608023; x=1734212823; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LcEsBkOR0IXFp+TmHIgG4yNI7CI4TTQsI2n7XV4yepw=; b=G3oDklOzKWqZ22xKGxs4rnPkZnP6e+crCxOMHO33ZCkUWWTqs5dFyYJYs3uqRQXckt OrlM/nLy8XEcBwvh3k0a8KHoXAF6mwPS9toI76Yk0OUMt84N4uUF+M3tCnGNeHHomCHV SgWPNbCByvbzgzcy6aNcvz+q1DpBFGRTy7TdHbuHlMrdgxRtwj+eLZFtf769CNg6RO/a caPj433rLynsvxy3f5wwsFDy3LcwkdRG6oLO/8DeH+Wal9Iwr6dj+N4kBLX+1frHk8eC lAVNEIFBlJSg4ZUProslHF+uHmDC968acsr9dcp2yI5CeMeY9WDYISYau35+m5ZJzf6y td5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733608023; x=1734212823; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LcEsBkOR0IXFp+TmHIgG4yNI7CI4TTQsI2n7XV4yepw=; b=toetXMVAXcPl9rhRdx77dWgcR0ZRr2o8wC6p2iIKHFqtOo6qtgZwh7pI+Eb9lec7as FtMoUEX59RW10errJewYMM7tR86Xuzq5HMZp9cuIsxrf2QL3p3fR2jFMdWRYOpoHNRO8 Cqmm8WJFTt4KuduW2eibNXhWsqaTwnKlJfnn+ehGZQy0BF4fVvAjyByVM5P49veVrrYc himHIufuSDeOy8osKVIxHoY5CKZ5pKdvuH3AXe49u/XHHMLAM/auuvHJqpjVRhnuum3g NHiQ79ymtXGDrdCeuOP8pyzCYpeE1xe8DQxojuqDNERJQonEPRlqAl5sImC/s3ftxZ7M KpGw== X-Gm-Message-State: AOJu0YxwlZuXVqfd8hPb+4bbBNXpxJvolcMWDt8tfVxbUUzOdAKOpULW K7OFjEZEDzq+dRAK/zBTazvopg+gmx5WdlTPx5hEWLcd7SwJWF7UnhuLWYNLxUi/Zo6Bwtc9J0K ToXnHh87q X-Gm-Gg: ASbGncte3vZSKpIqhKQa153LOHsaKUfksL6KtjdOAxoUBOC00KFPsFpSbxswyy7EpT6 1ol+U5VNN9Ml3bAtBUOA2vfxjbsUDI+TiedV5TX4qNjaYoEXKdq+C2IzcvC5Pwbf3ffU9HXeoLK WkX1oAEzt53RyLluadgGNP4Zke2FLE6eiZJcx2Otrg+8YM9LVwZHEjFzGEFFXiLEZTF3eQ85X/T tdRpwoDMOcVKRGXdV8uRI1bHD+qGTa9Fqk9KK+t+LwCSfnLuKF+yVrOjZ4r+IOff/C21iKok5rO qrjRl7/OaJxhlKUu5oEIA2Yo8AuLXgJalWFk X-Received: by 2002:a05:6870:971f:b0:29d:c9f6:efdc with SMTP id 586e51a60fabf-29f71ec8744mr4092700fac.17.1733608023297; Sat, 07 Dec 2024 13:47:03 -0800 (PST) Received: from localhost.localdomain (fixed-187-189-51-143.totalplay.net. [187.189.51.143]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-29fbee2df31sm10110fac.13.2024.12.07.13.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Dec 2024 13:47:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-stable@nongnu.org, wannacu Subject: [PATCH] tcg: Reset free_temps before tcg_optimize Date: Sat, 7 Dec 2024 15:47:00 -0600 Message-ID: <20241207214700.211066-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.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.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 When allocating new temps during tcg_optmize, do not re-use any EBB temps that were used within the TB. We do not have any idea what span of the TB in which the temp was live. Cc: qemu-stable@nongnu.org Fixes: fb04ab7ddd8 ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711 Reported-by: wannacu Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- Unless there's some other reason to spin an -rc4, this can wait to be the first patch for 10.0.1. r~ --- tcg/tcg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/tcg.c b/tcg/tcg.c index 0babae1b88..eece825e2e 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -6120,6 +6120,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, uint64_t pc_start) } #endif + /* Do not reuse any EBB that may be allocated within the TB. */ + memset(s->free_temps, 0, sizeof(s->free_temps)); + tcg_optimize(s); reachable_code_pass(s);