From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id BD816383868F for ; Thu, 8 Dec 2022 11:51:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD816383868F 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-ed1-x534.google.com with SMTP id i15so1749157edf.2 for ; Thu, 08 Dec 2022 03:51:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=b+ht5R/iQ87We7Kf2YaKzBm7hR6ESiXXTTsSP0kNaIo=; b=OXkzh8JtMqz4oSRmPnw+11wYlteV3610qh2oiGUmcUurAMkOAtlJyWK/2ya7I6ZTae T4YapxhPrmjbNUbuJgA/EGqrvQGMWrLRTrDDI0phrlWmwSyRG6ogidjuH0DQg+deTFZE IpYkCBstrO30qT9hsRyhe+ZqtJT1BOeU/17An8rS8zUuKGZq/bVFGQxDJQV3KaMA9uvu 0cpP2/Ul3RM8oPzJZZr4H2mF6uA9eF+BcQv3vhV7L9wZyDRGTQX34ICakgR3aH0h9v+U g05d3l/rS0p2r6/TKVF3bnomQgzq+LkKOiar6dKjf7G+dT5agIw24Ge5Rvc0npwiskfH qMsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b+ht5R/iQ87We7Kf2YaKzBm7hR6ESiXXTTsSP0kNaIo=; b=I7KyOXlkWq23/Exl+e+NInjc/EZsQDA6XAw1zk94pybzgKm3DR18VGMiZK9KPw8ThA SiEOo2a5BKAqkUBjXF/cHCb4mAplD5HNACG3gMSJIgZiOEeT1mrkMIlxQRp6eaWm1IBR MnoIoRj0TQDgHbmqCv1kfcFwCbWi2CNot0VGLPDJWGQN4V7+3jcBjNla4EFEpCMACcAO KCiD5rV5vZpvhHQeWne6S9ctqyzGKCiDN2Oon0dW0mJ2SR3CGFzhKPlHs1Ng72CL4xEV sfUalDmxx4QDvnsocmSFhdHKnTTps7eVwa4XAqv2JbioMifh0l+QaC17yMSEhL8jmWnu Hztw== X-Gm-Message-State: ANoB5pk+ntRqRhvEx4OXLafxd2lQCKD/j5dL5oaDK9KxJzQltnRKWXD1 OYctAYDzKBv5j4rpa6XBTe5QdLkEQR/OZpF0IbA= X-Google-Smtp-Source: AA0mqf6I5p4gxV6m6CFbctk8MrId4Fd3y25b22I3S+FxOcMUAaQkDBy7Hd0pxuiCLGNJQglMBVg6WZE5mFdIjBrRCfY= X-Received: by 2002:aa7:cb15:0:b0:458:e9c0:3e6f with SMTP id s21-20020aa7cb15000000b00458e9c03e6fmr85461788edt.61.1670500298274; Thu, 08 Dec 2022 03:51:38 -0800 (PST) MIME-Version: 1.0 References: <2858689.e9J7NaK4W3@fomalhaut> In-Reply-To: <2858689.e9J7NaK4W3@fomalhaut> From: Claudiu Zissulescu Ianculescu Date: Thu, 8 Dec 2022 13:51:26 +0200 Message-ID: Subject: Re: Possible regression in DF analysis To: Eric Botcazou Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: Hi Eric, The problem shows in loop-doloop.c when I introduce a loop end pattern that replaces the first jump instruction (JUMP_INSN 15) with a pattern that clobbers CC reg. However, the DF doesn't look like it works as the doloop step cannot find the CC reg alive. Please see loop-doloop.c:766. Hence, it introduces the doloop_end patterns, and renders the compare instruction (INSN 14) dead code. leading to errors. Thanks, Claudiu On Thu, Dec 8, 2022 at 1:33 PM Eric Botcazou wrote: > > > However, after this optimization I get the CC reg being dead after > > JUMP_INSN 15, which may lead to wrong code gen. Here it is the dump > > from fwprop1: > > > > (insn 14 11 15 3 (set (reg:CC 66 cc) > > (compare:CC (reg/v:SI 98 [ bytes ]) > > (const_int 8 [0x8]))) "bad_cc.c":11:8 406 {cmpsi} > > (nil)) > > (jump_insn 15 14 16 3 (set (pc) > > (if_then_else (gtu (reg:CC 66 cc) > > (const_int 0 [0])) > > (label_ref 27) > > (pc))) "bad_cc.c":11:8 15 {condjump} > > (expr_list:REG_DEAD (reg:CC 66 cc) > > (int_list:REG_BR_PROB 955630228 (nil))) > > -> 27) > > (note 16 15 18 4 [bb 4] NOTE_INSN_BASIC_BLOCK) > > (jump_insn 18 16 19 4 (set (pc) > > (if_then_else (eq (reg:CC 66 cc) > > (const_int 0 [0])) > > (label_ref:DI 34) > > (pc))) "bad_cc.c":12:10 15 {condjump} > > (expr_list:REG_DEAD (reg:CC 66 cc) > > (int_list:REG_BR_PROB 365072228 (nil))) > > -> 34) > > > > Please observe the REG_DEAD note on the both jump instructions. > > Passes that consume REG_DEAD/REG_UNUSED notes need to recompute them > explicitly, they are not updated on the fly. > > -- > Eric Botcazou > >