From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28740 invoked by alias); 15 Dec 2016 09:19:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28080 invoked by uid 89); 15 Dec 2016 09:19:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=kyrylo.tkachov@arm.com, kyrylotkachovarmcom, Kyrylo, kyrylo X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 15 Dec 2016 09:18:53 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D4171516; Thu, 15 Dec 2016 01:18:49 -0800 (PST) Received: from [10.2.207.77] (e100706-lin.cambridge.arm.com [10.2.207.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6BF873F220; Thu, 15 Dec 2016 01:18:48 -0800 (PST) Message-ID: <58525FF6.5090806@foss.arm.com> Date: Thu, 15 Dec 2016 09:55:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw Subject: Re: [PATCH][ARM] PR target/71436: Restrict *load_multiple pattern till after LRA References: <583F02B0.3030406@foss.arm.com> <58494A1F.8070005@foss.arm.com> In-Reply-To: <58494A1F.8070005@foss.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-12/txt/msg01341.txt.bz2 Ping. Thanks, Kyrill On 08/12/16 11:55, Kyrill Tkachov wrote: > Ping. > https://gcc.gnu.org/ml/gcc-patches/2016-11/msg03078.html > > Thanks, > Kyrill > > On 30/11/16 16:47, Kyrill Tkachov wrote: >> Hi all, >> >> In this awkward ICE we have a *load_multiple pattern that is being transformed in reload from: >> (insn 55 67 151 3 (parallel [ >> (set (reg:SI 0 r0) >> (mem/u/c:SI (reg/f:SI 147) [2 c+0 S4 A32])) >> (set (reg:SI 158 [ c+4 ]) >> (mem/u/c:SI (plus:SI (reg/f:SI 147) >> (const_int 4 [0x4])) [2 c+4 S4 A32])) >> ]) arm-crash.c:25 393 {*load_multiple} >> (expr_list:REG_UNUSED (reg:SI 0 r0) >> (nil))) >> >> >> into the invalid: >> (insn 55 67 70 3 (parallel [ >> (set (reg:SI 0 r0) >> (mem/u/c:SI (reg/f:SI 5 r5 [147]) [2 c+0 S4 A32])) >> (set (mem/c:SI (plus:SI (reg/f:SI 102 sfp) >> (const_int -4 [0xfffffffffffffffc])) [4 %sfp+-12 S4 A32]) >> (mem/u/c:SI (plus:SI (reg/f:SI 5 r5 [147]) >> (const_int 4 [0x4])) [2 c+4 S4 A32])) >> ]) arm-crash.c:25 393 {*load_multiple} >> (nil)) >> >> The operands of *load_multiple are not validated through constraints like LRA is used to, but rather through >> a match_parallel predicate which ends up calling ldm_stm_operation_p to validate the multiple sets. >> But this means that LRA cannot reason about the constraints properly. >> This two-regiseter load should not have used *load_multiple anyway, it should have used *ldm2_ from ldmstm.md >> and indeed it did until the loop2_invariant pass which copied the ldm2_ pattern: >> (insn 27 23 28 4 (parallel [ >> (set (reg:SI 0 r0) >> (mem/u/c:SI (reg/f:SI 147) [2 c+0 S4 A32])) >> (set (reg:SI 1 r1) >> (mem/u/c:SI (plus:SI (reg/f:SI 147) >> (const_int 4 [0x4])) [2 c+4 S4 A32])) >> ]) "ldm.c":25 385 {*ldm2_} >> (nil)) >> >> into: >> (insn 55 19 67 3 (parallel [ >> (set (reg:SI 0 r0) >> (mem/u/c:SI (reg/f:SI 147) [2 c+0 S4 A32])) >> (set (reg:SI 158) >> (mem/u/c:SI (plus:SI (reg/f:SI 147) >> (const_int 4 [0x4])) [2 c+4 S4 A32])) >> ]) "ldm.c":25 404 {*load_multiple} >> (expr_list:REG_UNUSED (reg:SI 0 r0) >> (nil))) >> >> Note that it now got recognised as load_multiple because the second register is not a hard register but the pseudo 158. >> In any case, the solution suggested in the PR (and I agree with it) is to restrict *load_multiple to after reload. >> The similar pattern *load_multiple_with_writeback also has a similar condition and the comment above *load_multiple says that >> it's used to generate epilogues, which is done after reload anyway. For pre-reload load-multiples the patterns in ldmstm.md >> should do just fine. >> >> Bootstrapped and tested on arm-none-linux-gnueabihf. >> >> Ok for trunk? >> >> Thanks, >> Kyrill >> >> 2016-11-30 Kyrylo Tkachov >> >> PR target/71436 >> * config/arm/arm.md (*load_multiple): Add reload_completed to >> matching condition. >> >> 2016-11-30 Kyrylo Tkachov >> >> PR target/71436 >> * gcc.c-torture/compile/pr71436.c: New test. >