From patchwork Fri Jul 12 07:48:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1131190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-504962-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jebW/Xk4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lQ6X4h9Xz9sBt for ; Fri, 12 Jul 2019 17:49:08 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=v/crf1gq5/vy1SwjyF0KUlVXEXYbJTLGdMGEH0pz/xwtVD0PJ+XvO TXhjQa59edgZs1RcporzIUISMnL3FiV1uoi+ufiKE1wcdwGV/vUyd5BldU7W7EcU 2Fnkz94D6/rUG6VCFcBcRS5VgEWQdYCn3aIzeJOj2Vnf5nN0qv9gXo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=3cXl7eX1T1JUcz80c+Di6bR5LSg=; b=jebW/Xk4Axfc/EKis3V1 G1bAxrJwcmLx8/+uxi+lJSPWfpH0iUfzsi/bELyZ7qXVgKcLi5DrhBQ/PgGc9I8D LZ6cT2CWr7IhPMs6tPSmnlFrRS4Lmy6HkICdz/iTLMYQZD+x9NqKBJV6ToIfFNiP y9fjD8b2qxIjqUUM54g+5nA= Received: (qmail 127010 invoked by alias); 12 Jul 2019 07:49:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 127002 invoked by uid 89); 12 Jul 2019 07:49:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jul 2019 07:49:00 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8E4C4337 for ; Fri, 12 Jul 2019 00:48:58 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 320B83F59C for ; Fri, 12 Jul 2019 00:48:58 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Relax vector_builder::elt sanity check Date: Fri, 12 Jul 2019 08:48:57 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 I'd made it a precondition of vector_builder::elt that the encoding must have been fully populated and that all implicit elements are therefore defined. But for one of the AArch64 patches I'm working on, it'd be convenient to be able to look back at previous elements while building up the encoding. This patch therefore makes the assert specific to implicit elements only. Tested on aarch64-linux-gnu, aarch64_be-elf and x86_64-linux-gnu. OK to install? Richard 2019-07-12 Richard Sandiford gcc/ * vector-builder.h (vector_builder::elt): Allow already-supplied elements to be read back before building is complete. Index: gcc/vector-builder.h =================================================================== --- gcc/vector-builder.h 2019-07-12 08:39:56.000000000 +0100 +++ gcc/vector-builder.h 2019-07-12 08:46:38.069172474 +0100 @@ -199,14 +199,15 @@ vector_builder::operator == T vector_builder::elt (unsigned int i) const { - /* This only makes sense if the encoding has been fully populated. */ - gcc_checking_assert (encoded_nelts () <= this->length ()); - /* First handle elements that are already present in the underlying vector, regardless of whether they're part of the encoding or not. */ if (i < this->length ()) return (*this)[i]; + /* Extrapolation is only possible if the encoding has been fully + populated. */ + gcc_checking_assert (encoded_nelts () <= this->length ()); + /* Identify the pattern that contains element I and work out the index of the last encoded element for that pattern. */ unsigned int pattern = i % m_npatterns;