From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id A85853856968 for ; Sat, 10 Jun 2023 15:49:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A85853856968 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-652328c18d5so2268793b3a.1 for ; Sat, 10 Jun 2023 08:49:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686412178; x=1689004178; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MtXGYdXXBxhamXsXM2JF0mKAbHpUWrY2gTuFAwAcz0M=; b=eU60tbHUkzrKMgJD7c42XRBleZQ07lco8gJ1hOuXb+So2dsI6UluQA/jMpGCEB+OTe KPdwpo7mv314wKSEFAqG5VJ7KcfJNpjLIlkSNEaXIGEE82+V2MPrG6B5dOtwq+V/PNOe k5/Z8LW6A/GDlP2GhkAwDteuFdzNZPpw5DcBKwxcI4a8j42Xn0m7/FvBYMN/NmM185UV ovsaau4pRqDdRe2/bziiB9JtHr3F5yHp7UfRcguo3fHgX5aFviJlJhy+4BouBh+qvtIu /B0/Pp0dltCW+JdEPkJL3eTjimiCUY1Ar1/kszGpOK5h604b5eZbCsQNSGChbWXvrjLo 4rJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686412178; x=1689004178; 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=MtXGYdXXBxhamXsXM2JF0mKAbHpUWrY2gTuFAwAcz0M=; b=c06Ki7C7wyHzpTZYI+16RaUkQPw2gvgGfmrcG4CMp//1fufpekoDUxHD4zY7odGtWn nxk+tT57VinpF/MahC9Y5N6H06AlkRRJyjXnROWydNeabjQSpDxWKovJhsQzwputWQgf EHxtSEzWDMLMnyrmbPTFAgLtJQHMwF6jTlqVhPHj4catjU64DabiUjR/4PtrRQS7BFK2 PdByvxjFF3gyh0X65szZf08lvo/0DrZ96xh9TTPDkQC0tlqmBUUNHSv0QCSg0+bIq6af IdJkIrNQgShKJ/8V4TKZf5uvTTF4YL3LCRlZe+GWRkm0jTvZ7Frk5rp2Z7+09qGfTfiu MANA== X-Gm-Message-State: AC+VfDxpL4eCH6a59OQ78/TymkctJAACQ2mhI6/B2SPgVOGXrVWKwxbM MFNJ0R3sbESYeURz/66TMIQ= X-Google-Smtp-Source: ACHHUZ5PMVWBbkZswwxHiVEuP5fXH6+XCLr3TEWt+SRcQEm/n8aymNTMtv2drCOgBAaft6GCUlcZyA== X-Received: by 2002:a17:902:9009:b0:1b2:48b:a22 with SMTP id a9-20020a170902900900b001b2048b0a22mr2103881plp.58.1686412178219; Sat, 10 Jun 2023 08:49:38 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id s11-20020a170902ea0b00b001afebec96basm5142420plg.148.2023.06.10.08.49.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Jun 2023 08:49:37 -0700 (PDT) Message-ID: Date: Sat, 10 Jun 2023 09:49:36 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 1/2] Implementation of new RISCV optimizations pass: fold-mem-offsets. Content-Language: en-US To: Manolis Tsamis , gcc-patches@gcc.gnu.org Cc: Richard Biener , Palmer Dabbelt , Philipp Tomsich , Kito Cheng References: <20230525123550.1072506-1-manolis.tsamis@vrull.eu> <20230525123550.1072506-2-manolis.tsamis@vrull.eu> From: Jeff Law In-Reply-To: <20230525123550.1072506-2-manolis.tsamis@vrull.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,NICE_REPLY_A,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 List-Id: On 5/25/23 06:35, Manolis Tsamis wrote: > Implementation of the new RISC-V optimization pass for memory offset > calculations, documentation and testcases. > > gcc/ChangeLog: > > * config.gcc: Add riscv-fold-mem-offsets.o to extra_objs. > * config/riscv/riscv-passes.def (INSERT_PASS_AFTER): Schedule a new > pass. > * config/riscv/riscv-protos.h (make_pass_fold_mem_offsets): Declare. > * config/riscv/riscv.opt: New options. > * config/riscv/t-riscv: New build rule. > * doc/invoke.texi: Document new option. > * config/riscv/riscv-fold-mem-offsets.cc: New file. > > gcc/testsuite/ChangeLog: > > * gcc.target/riscv/fold-mem-offsets-1.c: New test. > * gcc.target/riscv/fold-mem-offsets-2.c: New test. > * gcc.target/riscv/fold-mem-offsets-3.c: New test. So I made a small number of changes so that this could be run on other targets. I had an hppa compiler handy, so it was trivial to do some light testing with that. f-m-o didn't help at all on the included tests. But I think that's more likely an artifact of the port supporting scaled indexed loads and doing fairly aggressive address rewriting to encourage that addressing mode. Next I had an H8 compiler handy. All three included tests showed improvement, both in terms of instruction count and size. What was most interesting here is that f-m-o removed some redundant address calculations without needing to adjust the memory references which was a pleasant surprise. Given the fact that both ports worked and the H8 showed an improvement, the next step was to put the patch into my tester. It tests 30+ distinct processor families. The goal wasn't to evaluate effectiveness, but to validate that those targets could still build their target libraries and successfully run their testsuites. That's run through the various crosses. Things like the hppa, alpha, m68k bootstraps only run once a week as they take many hours each. The result is quite encouraging. None of the crosses had any build issues or regressions. The net result I think is we should probably move this to a target independent optimization pass. We only need to generalize a few things. Most importantly we need to get a resolution on the conditional I asked about inside get_single_def_in_bb. There's some other refactoring I think we should do, but I'd really like to get a resolution on the code in get_single_def_in_bb first, then we ought to be able to move forward pretty quickly on the refactoring and integration. jeff