From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 54A223858C2F for ; Thu, 15 Jun 2023 15:04:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54A223858C2F 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-x429.google.com with SMTP id d2e1a72fcca58-651ffcc1d3dso6111380b3a.3 for ; Thu, 15 Jun 2023 08:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686841481; x=1689433481; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=UNOFwB+R6SwLIRqhWecyZsELEEcLoMc7FB/FOvUCiBE=; b=jS1RX1tqN8kGc1xj4T5fHMuS8odSHGW9jRqO95VvSBmFik8nn7ufW7hLQa+wOeKxuf 8GWF8wE7Z/Qod6y5K8F8jm5Zk7YSaKweMWLmEg24MIbv4G0JOGUp6S7DUgh80tASzCGE xV3WlF+dWiT0Vjn13DRW5L4lu9qCmjxNMA1+gKvJG3/DX2h55R78LTbth4mzyipEhRfl dJP7lUog+6zWVFP2eMmqXbsQPkAFLyIagm2EXTFP7ZDWXw++MXOdT5H0u7QlFb7pK19W QzPOgGFTjeBNuZJ+wrYuc7bDGlvzFQeicvtJU3y9T6MHYC0FRYFFOmpN1FR6IZQAALaZ EWmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686841481; x=1689433481; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UNOFwB+R6SwLIRqhWecyZsELEEcLoMc7FB/FOvUCiBE=; b=B9FVxCumKNEQcep03Eh5yGXBgJopdKMdcqkwkUr7p8n8JYvkmTaLJGEibmCYLSAeFX CjRm9S9o3PsPRAfEExFLQnNitg/6wpyA8tEAnmlanECfVqYv4q7XlDDaKb7yulokC27O sXvW7ZIAT+UrEWeLaJhARsZ9zrQq7VZxUg2g9g8y6dHD04xt3spnSYXxtiYsivCYTNQF shXIsxHOokGABc7tJKk7m3TTZaLw0J6+yB1ZX8Yozh1NrGaVgxurcTeypNPP4c6YBL3f U622/Rl6kpLXTIZeFuP/7SoHB5SQXilInEXG7R3wFahhf+5mj4Hqg/aZWNra2B7rXabL aZXg== X-Gm-Message-State: AC+VfDwH64BXig7FKkjYWESPvTXXDmpLM5h6xfQ24+lapYjtfdSWuf7e lUBswmlsduKLcGmBPpl9hfU= X-Google-Smtp-Source: ACHHUZ5ul4PUdnQyuv2IEDZ09Kdm2cDGjyfI9rN/tYE7rTR+mPIEVsSYwWK9DwceTMlqDqD0xD8PTg== X-Received: by 2002:a05:6a00:3a1a:b0:654:9d3a:f970 with SMTP id fj26-20020a056a003a1a00b006549d3af970mr4759363pfb.31.1686841480926; Thu, 15 Jun 2023 08:04:40 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id z15-20020aa785cf000000b006413e6e7578sm2122103pfn.5.2023.06.15.08.04.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Jun 2023 08:04:40 -0700 (PDT) Message-ID: Date: Thu, 15 Jun 2023 09:04:38 -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 0/2] RISC-V: New pass to optimize calculation of offsets for memory operations. Content-Language: en-US From: Jeff Law 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> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 07:42, Jeff Law wrote: > Thanks Manolis.  Do you happen to know if this includes the fixes I > passed along to Philipp a few months back?  My recollection is one fixed > stale DF data which prevented an ICE during bootstrapping, the other > needed to ignore debug insns in one or two places so that the behavior > didn't change based on the existence of debug insns. So we stumbled over another relatively minor issue in this code this week that I'm sure you'll want to fix for a V2. Specifically fold_offset's "scale" argument needs to be a HOST_WIDE_INT rather than an "int". Inside the ASHIFT handling you need to change the type of shift_scale to a HOST_WIDE_INT as well and potentially the actual computation of shift_scale. The problem is if you have a compile-time constant address on rv64, it might be constructed with code like this: > (insn 282 47 283 6 (set (reg:DI 14 a4 [267]) > (const_int 348160 [0x55000])) "test_dbmd_pucinterruptenable_rw.c":18:31 179 {*movdi_64bit} > (nil)) > (insn 283 282 284 6 (set (reg:DI 14 a4 [267]) > (plus:DI (reg:DI 14 a4 [267]) > (const_int 1365 [0x555]))) "test_dbmd_pucinterruptenable_rw.c":18:31 5 {riscv_adddi3} > (expr_list:REG_EQUAL (const_int 349525 [0x55555]) > (nil))) > (insn 284 283 285 6 (set (reg:DI 13 a3 [268]) > (const_int 1431662592 [0x55557000])) "test_dbmd_pucinterruptenable_rw.c":18:31 179 {*movdi_64bit} > (nil)) > (insn 285 284 215 6 (set (reg:DI 13 a3 [268]) > (plus:DI (reg:DI 13 a3 [268]) > (const_int 4 [0x4]))) "test_dbmd_pucinterruptenable_rw.c":18:31 5 {riscv_adddi3} > (expr_list:REG_EQUAL (const_int 1431662596 [0x55557004]) > (nil))) > (insn 215 285 216 6 (set (reg:DI 14 a4 [271]) > (ashift:DI (reg:DI 14 a4 [267]) > (const_int 32 [0x20]))) "test_dbmd_pucinterruptenable_rw.c":18:31 204 {ashldi3} > (nil)) > (insn 216 215 42 6 (set (reg/f:DI 14 a4 [166]) > (plus:DI (reg:DI 14 a4 [271]) > (reg:DI 13 a3 [268]))) "test_dbmd_pucinterruptenable_rw.c":18:31 5 {riscv_adddi3} > (expr_list:REG_DEAD (reg:DI 13 a3 [268]) > (expr_list:REG_EQUIV (const_int 1501199875796996 [0x5555555557004]) > (nil)))) Note that 32bit ASHIFT in insn 215. If you're doing that computation in a 32bit integer type, then it's going to shift off the end of the type. Jeff