From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 652083858C5F for ; Thu, 5 Oct 2023 19:33:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 652083858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696534396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gtsNGWWMnYNb+W6dLavnGal5kUxhUW9lXPUD+PyE7Nc=; b=JGzRWOsETOWSUwIPneqzjrGT8mmj4H1BfzKMA5VoJQQjS86YYg0x9nV60Das2bFxT821TW 0eyGXYOqqvV6/uXeq2vCNZzoIjcAvZDbSsd6VzfSO6Fn9oZmlhPGtNklu6sui8Z49cqSKa +R7wjfgTTfsJysjkJFw72y9tVUpPYQM= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-463-MTOP0EwRNFSswdO3O5pP7w-1; Thu, 05 Oct 2023 15:33:14 -0400 X-MC-Unique: MTOP0EwRNFSswdO3O5pP7w-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-65afd7597baso12839206d6.2 for ; Thu, 05 Oct 2023 12:33:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696534394; x=1697139194; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gtsNGWWMnYNb+W6dLavnGal5kUxhUW9lXPUD+PyE7Nc=; b=gsJO/sDeFvT63jKKWFmmvPWmss3Ma22k6SYQKLVLDfvjLyrMXZfcOKh9BoKyCb1hRG g6sKGqsY8Rs4h9QCjdVVZwP0I1PXiAFmltXv0CWumlAhR/dhST7NJKjJxtpxBN+4MEPP Kpqqd7FOKRDmNKFph/lE0EZTdK59GoA+3MIS/h9XizOkG0fXWfJO8P3nk7hny8D5qjzZ KYMJF7RmEDxGT0Ysn3nfosTLYtFHv9FKrOU2xswiGSW91XyrWt3+MszMaSspOIRh7b0Z SIgUPNGfRqw+h3wbNEDv7OWANu46FIp6Nrkgbz2Togh0BvD6gNqVJYUw8ntkTiWIkEoc pDHQ== X-Gm-Message-State: AOJu0Yx9LbH2/ufoMmDF+nUAuZyY5S2qcAvPft8fzqpJzKU9I0RnTPTa in9f+2II1CL+0qyMQrsc5vD7tWto2fT6sd1u1zXGYscsFZrRfEMQNDun5lg62ApgkqwhMNQDm8c 5lBZ7rB6xaMXJoXBPJQ== X-Received: by 2002:a05:6214:3b85:b0:656:49a3:21a7 with SMTP id nf5-20020a0562143b8500b0065649a321a7mr6260768qvb.16.1696534393849; Thu, 05 Oct 2023 12:33:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHq5nJ44LNExo6pu1fpFHDmdxDPGsT32sxLXsxOFd4jBrhgrxVd+wETHOM73mPDxAIewZhQA== X-Received: by 2002:a05:6214:3b85:b0:656:49a3:21a7 with SMTP id nf5-20020a0562143b8500b0065649a321a7mr6260751qvb.16.1696534393580; Thu, 05 Oct 2023 12:33:13 -0700 (PDT) Received: from [192.168.1.88] (23-233-12-249.cpe.pppoe.ca. [23.233.12.249]) by smtp.gmail.com with ESMTPSA id w17-20020a0cdf91000000b0063d162a8b8bsm740157qvl.19.2023.10.05.12.33.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Oct 2023 12:33:13 -0700 (PDT) Message-ID: Date: Thu, 5 Oct 2023 15:33:12 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: LRA for avr: Maintain live range info for pseudos assigned to FP? To: SenthilKumar.Selvaraj@microchip.com Cc: gcc@gcc.gnu.org References: <8a903bb0d2f0446e59825dcd2f684ae20fcb6b8b.camel@microchip.com> From: Vladimir Makarov In-Reply-To: <8a903bb0d2f0446e59825dcd2f684ae20fcb6b8b.camel@microchip.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,TXREP,T_SPF_TEMPERROR,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 9/7/23 07:21, SenthilKumar.Selvaraj@microchip.com wrote: > Hi, > > One more execution failure for the avr target, this time from > gcc.c-torture/execute/bitfld-3.c. > > Steps to reproduce > > Enable LRA in avr.cc by removing TARGET_LRA_P hook, build with > > $ make all-host && make install-host > > and then > > $ avr-gcc gcc/testsuite/gcc.c-torture/execute/bitfld-3.c -S -Os -mmcu=avr51 -fdump-rtl-all > > When lra_update_fp2sp_elimination runs and pseudos assigned to the > FP have to be spilled to stack slots, they sometimes end up in a > slot that already has a reg with an overlapping live range. This is > because lra_reg_info[regno].live_ranges is NULL for such spilled > pseudos, and therefore when assign_stack_slot_num_and_sort_pseduos > checks if lra_intersected_live_ranges_p, it always returns false. > > In the below reload dump, all the pseudos assigned to FP get > allocated to slot 0. The live ranges for some of them (r1241 for > e.g.) conflicts with r603 that was originally assigned to slot 0, > but they still end up in the same slot, causing the execution failure. > Sorry for the delay with the answer, Senthil.  Avr is unusual target and needs some changes in LRA but the changes improves LRA portability.  So thank you for your work on porting LRA to AVR. The patch is ok for me.  The only comment is that making calculation of the set only once would be nice. Live range calculation in LRA can take a lot of time, code of update_pseudo_point is hot and the worst the set will be really used rarely but it is calculated every time. You can commit the current patch and I'll do it by myself or, if you want, you can modify the patch by yourself and submit it for review and I'll review as soon as possible.  Either way works for me. > > diff --git a/gcc/lra-lives.cc b/gcc/lra-lives.cc > index f60e564da82..e4289f13979 100644 > --- a/gcc/lra-lives.cc > +++ b/gcc/lra-lives.cc > @@ -250,7 +250,17 @@ update_pseudo_point (int regno, int point, enum point_type type) > if (HARD_REGISTER_NUM_P (regno)) > return; > > - if (complete_info_p || lra_get_regno_hard_regno (regno) < 0) > + /* Pseudos assigned to the FP register could potentially get spilled > + to stack slots when lra_update_fp2sp_elimination runs, so keep > + their live range info up to date, even if they aren't in memory > + right now. */ > + int hard_regno = lra_get_regno_hard_regno (regno); > + HARD_REG_SET set; > + CLEAR_HARD_REG_SET(set); > + add_to_hard_reg_set (&set, Pmode, HARD_FRAME_POINTER_REGNUM); > + > + if (complete_info_p || hard_regno < 0 > + || overlaps_hard_reg_set_p (set, PSEUDO_REGNO_MODE (regno), hard_regno)) > { > if (type == DEF_POINT) > { > >