From patchwork Tue Nov 7 09:19:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 162333 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111847vqo; Tue, 7 Nov 2023 01:21:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBF4Q8vtr2clXrKBcEyjZc6xMzKrl/MhNezF2W2yx+QYKxXmE5p7HEo3fJWEXZfHxeLZI6 X-Received: by 2002:ac8:5f4d:0:b0:418:fab:2d31 with SMTP id y13-20020ac85f4d000000b004180fab2d31mr39990799qta.4.1699348901851; Tue, 07 Nov 2023 01:21:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348901; cv=pass; d=google.com; s=arc-20160816; b=PytkEnEmq2ZEyYF2mqaYSVv6bTNMNOCOPxvRxjZqmLJHDHD/42xAaxyR0LV1bbGBFh Oxq/XGB9MJGAee4ZdCrT7wc1k89uwM34hMFFgEEuUIV0C6kbM7LI5IqNf7h1gidCkE45 lmVThPuxkXbElNka7atJZJ2c7znKi7OxjP876+W7ZmUYqSzOg4AT73W5/4v9HRkwLITD HWbPnWMxc1lftqjzSZDbgIHQFZUnTgb6j4PNr/0VALz3onf9YFCnWi6oCic44Ft6wkKK h2c77GRC00rSyMeKlX9gBV8tnYUwNmO/YT2cFNaUfqBHyNJGZrzWeqHVzvuK5lvpTvad btEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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 :arc-filter:dmarc-filter:delivered-to; bh=lmkJa1jWd6Cg/qdzRZaXhYok8jBc03rOGsfNpwXhd5w=; fh=QRb7QY4BZ0mIIAPiH2G4K0PcYKRtRn2i5A6VLUA8cN4=; b=IL6Oy0/buEQI7CxbgQSf9HoaQkATP/4snPCMWRDgBO4Pa4yRTQcltG0JI4iAPQ5kqv 7PDoR2tZqyOIAbEhdT9xNjLYyeXtyr1If7zJFr5CUcpmtPmUMx9/gBpTG0Cf9lmP6iYE m8LlUOxFuMZpbA5qu5C1fYpgpwzJFQZuMAqgk14BVJ+1TpSurx5KdlxVe66tHqqWdtwE d6wFDm1yb7x0L0L9F2IOm8soEjeTXf0rKjiz1J7Sbs8qQC5IowUSD/pxFTVQPHB4oCwP KQldih3RpwKoLB/CD4flSL9Gx4ejUXx+wPBWEjp8U5ZyJ4cJ+LwnDCjdRWHeSUSgtN98 ACJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=GrS2zF5G; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id z7-20020a05622a060700b00419578c5b2fsi6657916qta.281.2023.11.07.01.21.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=GrS2zF5G; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6634938319FC for ; Tue, 7 Nov 2023 09:21:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 8BA683856DD0 for ; Tue, 7 Nov 2023 09:19:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8BA683856DD0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8BA683856DD0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348787; cv=none; b=kCjLLZ6cnF6V3gnZERLfMQw9XxWberqnOaet3CI8HRebobXhRhiqvQwWsrWpTFJReQr57tO/YjLcmJIFppJwv7kqLR6wtxdxw3KzB7EvPAt4M55D0m4AWYyyLFDnsq5zKQdPlGvMzoss7T31dLA8Wuc4h8yApa/2dSDvKeIOqaY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348787; c=relaxed/simple; bh=rGBjz+7MWp4Mt6yE7QHXzacXcQJXo/Xd9cLKjhnBpOo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ox5IARAZbqE0xLyD0tM+8zyXCPBT9n0y2HvI+9UUZvf3FaaXscGWXO76OlHCIDk24sW2X+ho57WaDRB7FTnfHdrckNkUs4+ofDsVKUN8BYUAdty6L7ne2CVG3h7ZQut2me3C2iDFWAJwP+8iCykqdQ1DeMnClAmLCDTjVXP8eYk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-32f8441dfb5so3697268f8f.0 for ; Tue, 07 Nov 2023 01:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348785; x=1699953585; 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=lmkJa1jWd6Cg/qdzRZaXhYok8jBc03rOGsfNpwXhd5w=; b=GrS2zF5GdWrMfsf2yv61R/IfHLiSOLTh3q8wk7B8z4bLR8zqHkPY5leGfFMOypSV8q /3NrKZWtAuuJJzUtAjCGbU6+kZnqqFrWb5EjXqOCn1PiD08M24wm+I2pmHA1faGN4AUf +koZHhA2eNsIeaOU4hlptN2IjVDT4hn1bJY+kSb0GXHKlTRZ7qf0AGuzWajQoOPnkXeQ nNtY9xrvyh/2IqOTKy6TYUTzI0yq/eo+YSexbUCu6mZf+cGOMIrlGLJLMBnV+2atrKh1 D0i8QDHvlQY4wRXbc4PEU6cwFGnaPfcwVSwopQ1L9n7EJasHphlKCwiLuxCrZGD4hM7g Z/7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348785; x=1699953585; 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=lmkJa1jWd6Cg/qdzRZaXhYok8jBc03rOGsfNpwXhd5w=; b=lbeV9vDBtJGa6oLckb1u0wqEbmjLFU9gKT6CDn5RQgUNG1MwPVn8ymSYcz215hJZHA W8UzfvV00kFemKj0ePKEKtFPmzRjTIXfWwHo6ETWvu/Jhs8noZoBqudOm6/qaxUeO3rx N1M+vJfbIgN5A0RYD3khw0PVyg947bNbgxLBn0Q5Vff8x6SXnYhrUU2jR7gyQN5bXbBy fT0Oil24XBH6omGaIjV/9UPbip8TwWlXZt2wYCNjgNlogIPNMuhwQCvjvpPWMATVOfCJ gOklFP053inUjAiOhwOCe8Fpap8fBPmKeyg57MEmmKIaSNaUFk4F68e/q3po5HjZ1Gsc gNEg== X-Gm-Message-State: AOJu0Yx0xxyrFugk0Mrwe38sVrfwuagYdVBzNGP0//hkhpBe2Uu2HJTR K6STDl9uWE7Q4DoIKtwqNctpiM2Uhnv+mGVLFBXacQ== X-Received: by 2002:a5d:4d09:0:b0:32d:9d99:94e7 with SMTP id z9-20020a5d4d09000000b0032d9d9994e7mr25004768wrt.49.1699348785380; Tue, 07 Nov 2023 01:19:45 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id g3-20020adffc83000000b00323293bd023sm1803627wrr.6.2023.11.07.01.19.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:45 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Avoid extra conversion in expansion of packed array assignments Date: Tue, 7 Nov 2023 10:19:42 +0100 Message-ID: <20231107091942.3905723-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896473862561085 X-GMAIL-MSGID: 1781896473862561085 From: Piotr Trojanek Expansion of assignments to packed array objects with string literals on the right-hand side, created an unnecessary conversion, i.e.: ... := component_type (declare temp : component_type := "string_literal"; begin temp) Now the expansion omits the outer type conversion. Cleanup; behavior is unaffected. gcc/ada/ * exp_pakd.adb (Expand_Bit_Packed_Element_Set): Simplify handling of assignments with string literals. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_pakd.adb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index ef0ec1e0014..e197211736a 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -1143,9 +1143,10 @@ package body Exp_Pakd is Insert_Actions (N, New_List (Decl)); Rhs := New_Occurrence_Of (Defining_Identifier (Decl), Loc); end; + else + Rhs := Convert_To (Ctyp, Rhs); end if; - Rhs := Convert_To (Ctyp, Rhs); Set_Parent (Rhs, N); -- If we are building the initialization procedure for a packed array,