From patchwork Thu Aug 22 11:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manolis Tsamis X-Patchwork-Id: 1975444 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=vrull.eu header.i=@vrull.eu header.a=rsa-sha256 header.s=google header.b=VdcZKoeB; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WqL2J37Jfz1yYZ for ; Thu, 22 Aug 2024 21:04:53 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7FAD3846088 for ; Thu, 22 Aug 2024 11:04:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id 3AD163858283 for ; Thu, 22 Aug 2024 11:04:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3AD163858283 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=vrull.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vrull.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3AD163858283 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::235 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724324672; cv=none; b=TfyYSWJx4GQrlbH/jPd7hO2yqLw5Rd9g/9fDlx4GmXnGaVfQvcsrIphT4vBPbdNjnOJTgklqijqY703znAEUpEexjdrWlxDjSpi21ijp8wZ5we4wIwUolm5t855o2awvAPeaq5L8TAHjOvqdP+o+iQfwbp+Ef63LpKqaoRrljtQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724324672; c=relaxed/simple; bh=IJLS+NtY8mRT75XpH1M9BTi9N1NusHxucE2d1UBOB4w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tY8oiXMiGIUgvIsYvvtOvvVHNU7VVDp40sqPJ9N8Tn3qaE2LV6g0axI2Fq7qYJEyf/0kVZhIjC+ZpiXv8EtH63/Bj7JHXEEj1pMqsXnJne7tdsr6FPG2oCLwVHTJ9Ej6TNJALuEadXbS49iTMM5QbT2EuA8a5WP1GrMTDJUVvKQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2f3f90295a9so6572051fa.0 for ; Thu, 22 Aug 2024 04:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1724324661; x=1724929461; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6rb+UUaTPhbL4ldvymUVPrlMgompxE0Sc9io3hqee1g=; b=VdcZKoeBTLQ7ELGbXIvgcdC305G6NjcsHt+Q/bgPZ3vLBSDFQrSZ4yeXHqKRPIJFgn W5N1uTQa0ZWU0ix9eZEXpjRHVZ6jktqW5f8vGjEJLdToT3yWWCK4bARG7CA71BJbtmns +ePp73BolYHLl2Lzjee+SQtM1BKmXYQo1id8I6zhgldD4+F0+ZjmPnjh+tDqa6i+oZdQ 3IqIuU+Z+xD8TwDI+Gdu8H9wEXPXbPb5tnNe6sWvLDusDcM8hbGuyR603puP6+Knhf7j hEj+vYoD/UKq0HXcrRksf7rAIjBNxKF3vj/xtAKzY+jTyycFyamBdiPM0TpyNasn7LZu IeEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724324661; x=1724929461; 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=6rb+UUaTPhbL4ldvymUVPrlMgompxE0Sc9io3hqee1g=; b=JsjwXrcNlAo/TT30KQ/kIP7MJZWsTAubbPOYOAzKLWtoM4xUgxkdFZdNvh9SWnTRK0 iiwxGW6c1PeCaCKu+VvbNbYbQuF/wj6N+xuguGH0yO/iLBCIrrDaiQ8a+6jQTnxTRHQI T5Zv1yxuDwzKKLQ5MpLscpR5DOmzfRkPbZT9okXxsBknOWLnzfr0rCAcuTktreLil6lE TpLoG9ypL1FRL1c6CfWsWYHbbpVwBmaKuGith9SYLrcI03RvcdEJn7MBvn7teR0yqoXl FAhFwSzl0gjueqNf9/m/AWic0npVf/9n8AnfYGRSdOlSmZC+ViSqKe+t6Z3wOM+b7j2l uEEA== X-Gm-Message-State: AOJu0YwWXvOn5w0zxY2XpFxCnULg8UmoqetumxoxR0Uymsp1DH4axH9k KEFnQ1DE0cDiktgEE9GqdUY3hZkwGz+kr6L1e2hN70P5Cz6Frx0DyE2MEc5moVIvlzYTpY5yyn4 o X-Google-Smtp-Source: AGHT+IEQLuiZ4cH6ef2C7ZbNPuZFF0rKprNORLWnM/fEc9d3ttcVSwuyyGqrxx6jSetbPU+rH1yy5A== X-Received: by 2002:a05:651c:b21:b0:2ef:1b64:5319 with SMTP id 38308e7fff4ca-2f3f881cffamr39092931fa.11.1724324660071; Thu, 22 Aug 2024 04:04:20 -0700 (PDT) Received: from altra2.sec.univie.ac.at (altra2.sec.univie.ac.at. [131.130.126.102]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c0515a945dsm769530a12.94.2024.08.22.04.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 04:04:19 -0700 (PDT) From: Manolis Tsamis To: gcc-patches@gcc.gnu.org Cc: Philipp Tomsich , =?utf-8?q?Christoph_M=C3=BCl?= =?utf-8?q?lner?= , Jeff Law , Sam James , Andrew Pinski , Manolis Tsamis Subject: [PATCH] ifcvt: Disallow emitting call instructions in noce_convert_multiple_sets [PR116358] Date: Thu, 22 Aug 2024 04:04:05 -0700 Message-ID: <20240822110409.3798604-1-manolis.tsamis@vrull.eu> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Similar to not allowing jump instructions in the generated code, we also shouldn't allow call instructions in noce_convert_multiple_sets. In the case of PR116358 a libcall was generated from force_operand. PR middle-end/116358 gcc/ChangeLog: * ifcvt.cc (noce_convert_multiple_sets): Disallow call insns. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr116358.c: New test. Signed-off-by: Manolis Tsamis --- gcc/ifcvt.cc | 2 +- gcc/testsuite/gcc.target/aarch64/pr116358.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pr116358.c diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index da59c907891..b136d7dbbba 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -3550,7 +3550,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) return false; for (insn = seq; insn; insn = NEXT_INSN (insn)) - if (JUMP_P (insn) + if (JUMP_P (insn) || CALL_P (insn) || recog_memoized (insn) == -1) return false; diff --git a/gcc/testsuite/gcc.target/aarch64/pr116358.c b/gcc/testsuite/gcc.target/aarch64/pr116358.c new file mode 100644 index 00000000000..0a5fd9e02b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr116358.c @@ -0,0 +1,15 @@ +/* PR middle-end/116358 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +long long f(int b, int c, long long d) +{ + if (c) { + long long bb = b; + long long t2 = (bb < 16 ? bb : 16); + d = t2 - 16; + } + return d; +} + +/* { dg-final { scan-assembler-not "bl" } } */