From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by sourceware.org (Postfix) with ESMTPS id 7BC253858433 for ; Tue, 28 Sep 2021 10:55:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7BC253858433 Received: by mail-ed1-x533.google.com with SMTP id y35so30440488ede.3 for ; Tue, 28 Sep 2021 03:55:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hM0H9rkMG/YAaJWjWFVoYTcPW+iFWpL5gvCvCbR438Y=; b=BDT9elONIOBnWsxLi+67JJoGIVtMHxqRg0MWJhTmLGL3VF1P2w9+2UKwf6AtVJli+8 bHNH/WskaxG2Egcnr01IDiOmGlF39NXpfIbsJ3iuS83iV+OflXwdKe6TELKoxAw439Di vMjQSoJYyewS82VVQ454gV7P1qjOTI2cYauZmuilI9ysNJiZ8dajEKQDjEDkvVtWto7h uv3dYbl+S6t45UqgmE3Ip/pG8/mmGotzJ4gFMlpfvfnrSeyZMK264Yb9DP/Gh9d6UKTe IXYhAdep+HfXIjpkpnm7bsVzHBXlq7+AogVxJHtvMIWn6z8HnoL2GqoOyl5oNwb6/5L9 gMBQ== X-Gm-Message-State: AOAM5303kaWIBjePHMpxuxDjGy7iiOXRgPuN+k0X7i4ni+EvjfRfv9et ME3N8lXgXdCdcX9SSDzKD0Hi8H50WtgkjS3OYV8= X-Google-Smtp-Source: ABdhPJy6TBDHBESn91Yi0hAeW4y5O+dUgDuN4J3PZ27ck6yPId1geS3JsbPdyNsIAw7DadUbipJqH7PwKTWpy4hQzDM= X-Received: by 2002:a17:906:fa8c:: with SMTP id lt12mr5652353ejb.204.1632826505460; Tue, 28 Sep 2021 03:55:05 -0700 (PDT) MIME-Version: 1.0 References: <20210927150003.796951-1-aldyh@redhat.com> <7ea0e648-1456-8c9f-1d26-83cd149fc2d3@gmail.com> <0c1d857c-6d17-6f91-6aa7-4af1a8391ec8@gmail.com> In-Reply-To: From: Richard Biener Date: Tue, 28 Sep 2021 12:54:54 +0200 Message-ID: Subject: Re: [PATCH] Control all jump threading passes with -fjump-threads. To: Aldy Hernandez Cc: Jeff Law , GCC patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 10:55:08 -0000 On Tue, Sep 28, 2021 at 11:42 AM Aldy Hernandez wrote: > > > > On 9/28/21 9:41 AM, Richard Biener wrote: > > On Tue, Sep 28, 2021 at 8:29 AM Jeff Law via Gcc-patches > > wrote: > >> > >> > >> > >> On 9/28/2021 12:17 AM, Aldy Hernandez wrote: > >>> On Tue, Sep 28, 2021 at 3:46 AM Jeff Law wrote: > >>>> > >>>> > >>>> On 9/27/2021 9:00 AM, Aldy Hernandez wrote: > >>>>> Last year I mentioned that -fthread-jumps was being ignored by the > >>>>> majority of our jump threading passes, and Jeff said he'd be in favor > >>>>> of fixing this. > >>>>> > >>>>> This patch remedies the situation, but it does change existing behavior. > >>>>> Currently -fthread-jumps is only enabled for -O2, -O3, and -Os. This > >>>>> means that even if we restricted all jump threading passes with > >>>>> -fthread-jumps, DOM jump threading would still seep through since it > >>>>> runs at -O1. > >>>>> > >>>>> I propose this patch, but it does mean that DOM jump threading would > >>>>> have to be explicitly enabled with -O1 -fthread-jumps. An > >>>>> alternative would be to also offer a specific -fno-dom-threading, but > >>>>> that seems icky. > >>>>> > >>>>> OK pending tests? > >>>>> > >>>>> gcc/ChangeLog: > >>>>> > >>>>> * tree-ssa-threadbackward.c (pass_thread_jumps::gate): Check > >>>>> flag_thread_jumps. > >>>>> (pass_early_thread_jumps::gate): Same. > >>>>> * tree-ssa-threadedge.c (jump_threader::thread_outgoing_edges): > >>>>> Return if !flag_thread_jumps. > >>>>> * tree-ssa-threadupdate.c > >>>>> (jt_path_registry::register_jump_thread): Assert that > >>>>> flag_thread_jumps is true. > >>>> OK. Clearly this is going to be even better once we disentangle > >>>> threading from DOM. > >>> Annoyingly, I had to tweak a few more tests, particularly some > >>> -Wuninitialized -O1 ones which seem to depend on DOM jump threading to > >>> give proper diagnostics. It seems that every change to jump threading > >>> needs tweaks to the Wuninitialized code :-(. > >> Well, a lot of jump threading is there to help eliminate false positives > >> from Wuninitialized by eliminating paths through the CFG that we can > >> prove never execute at runtime. SO that's not a huge surprise. > > > > I would have suggested to enable -fthread-jumps at -O1 instead > > and eventually just add && flag_expensive_optimizations to the > > use in cfgcleanup.c to restrict that to -O2+ > > Hmmm, that's a much better idea. I was afraid of messing existing > behavior, but I suppose adding even more false positives for -O1 > -Wuninitialized is worse. > > BTW, I plugged one more tweak to the registry in > remove_jump_threads_including. No need to go add things to the removed > edges hash table, if we're not going to thread. > > OK pending tests? OK. Richard. > Aldy