From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id F13363858D32 for ; Thu, 7 Jul 2022 14:46:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F13363858D32 Received: by mail-pf1-x436.google.com with SMTP id g126so5413730pfb.3 for ; Thu, 07 Jul 2022 07:46:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:from:subject:cc; bh=JOZ9dYub7WF7FokkhN+TtZvIRKwl8qmc8Cjjcc/O9wo=; b=juURPufuYXpTmRcf5B7LgPN6nqAtBUh7K6HoqKtBtODh6yBFIAFm5u1aqvuhtm+zdB e7dqf6jxTMN0nFMWKGpVN0TY50jxpWerbTe9MItV3P0F27yyvVVk7VHwxW/+kUScRouX CGppNJDkoInr/iGhn1tjBCsUGlL9dQDt862BMsBUwzfc0XiP9w34CiXzQ0w3gSrhspHN WkDKCHtTK6NWzbm96Ld6ciREtLUFMoOH0Vb7yry/iC1JHStZQPaEXDLEjqgXin2iaU13 2/GUb1ebFLiQMEPI/68s68lA4idSe9zzGrAYhfiOnh8ob6M04sxAjmO3jaedLHGtb3xk xOkQ== X-Gm-Message-State: AJIora+jwBVE0taJnLyOry1fAGhjJa2VPvOKvIxbkRC4qWQ5D5YupOKL 8tooEWf48Bcp+pjSOJ5lZq4Jp/ZJowM= X-Google-Smtp-Source: AGRyM1sQoBFNWQcYjnTcKDbJPaFwDcdmbyI5kFVEtWgNGdAGXIpInjVW5FJ40/tYx8WOGnX172hfPw== X-Received: by 2002:a17:902:cf06:b0:16b:cc33:5bce with SMTP id i6-20020a170902cf0600b0016bcc335bcemr31191709plg.152.1657205177563; Thu, 07 Jul 2022 07:46:17 -0700 (PDT) Received: from [172.31.0.204] (c-73-63-24-84.hsd1.ut.comcast.net. [73.63.24.84]) by smtp.gmail.com with ESMTPSA id s8-20020aa78d48000000b0052089e1b88esm27094074pfe.192.2022.07.07.07.46.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jul 2022 07:46:17 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------uuhXTBnkfuYBfb0YO6uRYn0Y" Message-ID: <446ea3de-5486-8756-47f1-7822d79c5d75@gmail.com> Date: Thu, 7 Jul 2022 08:46:16 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-US To: 'GCC Patches' From: Jeff Law Subject: [RFA] Improve initialization of objects when the initializer has trailing zeros. X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2022 14:46:21 -0000 This is a multi-part message in MIME format. --------------uuhXTBnkfuYBfb0YO6uRYn0Y Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit This is an update to a patch originally posted by Takayuki Suwa a few months ago. When we initialize an array from a STRING_CST we perform the initialization in two steps.  The first step copies the STRING_CST to the destination.  The second step uses clear_storage to initialize storage in the array beyond TREE_STRING_LENGTH of the initializer. Takayuki's patch added a special case when the STRING_CST itself was all zeros which would avoid the copy from the STRING_CST and instead do all the initialization via clear_storage which is clearly more runtime efficient. Richie had the suggestion that instead of special casing when the entire STRING_CST was NULs  to instead identify when the tail of the STRING_CST was NULs.   That's more general and handles Takayuki's case as well. Bootstrapped and regression tested on x86_64-linux-gnu.  Given I rewrote Takayuki's patch I think it needs someone else to review rather than self-approving. OK for the trunk? Jeff --------------uuhXTBnkfuYBfb0YO6uRYn0Y Content-Type: text/plain; charset=UTF-8; name="P" Content-Disposition: attachment; filename="P" Content-Transfer-Encoding: base64 CSogZXhwci5jYyAoc3RvcmVfZXhwcik6IElkZW50aWZ5IHRyYWlsaW5nIE5VTHMgaW4gYSBT VFJJTkdfQ1NUCglpbml0aWFsaXplciBhbmQgdXNlIGNsZWFyX3N0b3JhZ2UgcmF0aGVyIHRo YW4gY29weWluZyB0aGUKCU5VTHMgdG8gdGhlIGRlc3RpbmF0aW9uIGFycmF5LgoKZGlmZiAt LWdpdCBhL2djYy9leHByLmNjIGIvZ2NjL2V4cHIuY2MKaW5kZXggNjIyOTczNzllYzkuLmY5 NGQ0NmI5NjljIDEwMDY0NAotLS0gYS9nY2MvZXhwci5jYworKysgYi9nY2MvZXhwci5jYwpA QCAtNjA4Nyw2ICs2MDg3LDE3IEBAIHN0b3JlX2V4cHIgKHRyZWUgZXhwLCBydHggdGFyZ2V0 LCBpbnQgY2FsbF9wYXJhbV9wLAogCX0KIAogICAgICAgc3RyX2NvcHlfbGVuID0gVFJFRV9T VFJJTkdfTEVOR1RIIChzdHIpOworCisgICAgICAvKiBUcmFpbGluZyBOVUwgYnl0ZXMgaW4g RVhQIHdpbGwgYmUgaGFuZGxlZCBieSB0aGUgY2FsbCB0bworCSBjbGVhcl9zdG9yYWdlLCB3 aGljaCBpcyBtb3JlIGVmZmljaWVudCB0aGFuIGNvcHlpbmcgdGhlbSBmcm9tCisJIHRoZSBT VFJJTkdfQ1NULCBzbyB0cmltIHRob3NlIGZyb20gU1RSX0NPUFlfTEVOLiAgKi8KKyAgICAg IHdoaWxlIChzdHJfY29weV9sZW4pCisJeworCSAgaWYgKFRSRUVfU1RSSU5HX1BPSU5URVIg KHN0cilbc3RyX2NvcHlfbGVuIC0gMV0pCisJICAgIGJyZWFrOworCSAgc3RyX2NvcHlfbGVu LS07CisJfQorCiAgICAgICBpZiAoKFNUT1JFX01BWF9QSUVDRVMgJiAoU1RPUkVfTUFYX1BJ RUNFUyAtIDEpKSA9PSAwKQogCXsKIAkgIHN0cl9jb3B5X2xlbiArPSBTVE9SRV9NQVhfUElF Q0VTIC0gMTsK --------------uuhXTBnkfuYBfb0YO6uRYn0Y--