From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id 2E7AD3858430 for ; Tue, 12 Oct 2021 12:23:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E7AD3858430 Received: by mail-ed1-x52c.google.com with SMTP id g8so80468217edt.7 for ; Tue, 12 Oct 2021 05:23:32 -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=f3In6lFGSC2rhe9Cgrkr/CR8a4ia0sgx1sOyV9IZDfo=; b=5alIl334KJF7o3g/j2B26U+7ypNvrBcluQtxpmJ41xAdUAQXxMC21vdvBrLLpwlvIC tdVLTXhUJFdg4jMD9AFcvvROQQHwodj/ywZt7dSYo5YZPNw9E+8zACEKkMFvdbpsl9nC BwhO8zB+tfU9TcVhPd2k3xVOyi59qTD/QfKjd3rRjWbobYNZeVj7+4z5mQpXepkPX+TR lwRK8dXyj2S4GmVJO7ArzfacosVaopEO1GwoSM3l5/hsscBxX1MhX9rcTeqiuEhCooCV AzHPkhqWen5QgiXXT9XR730+//Dtn7FHaHmqb8B5oCGmjimYrZ2N6SxLgmbMr0gLiyGw MziA== X-Gm-Message-State: AOAM530bd6rhKwdxIdg6ihjAGqWYJ2f32Ha8HciTcycxVlEOOJdir4CH 4VhgVMyfaoYADwyQtzsKF3LpX2ILZZU0MWZ34p/Wvqg8 X-Google-Smtp-Source: ABdhPJyO7RR4LRtrJO7LUD7jsCKF6ssAQ+del5wuEjutAeuP+LlD30gY2Or6O7RND9p6IHZSj691y0+yGNSY+1ZoyxM= X-Received: by 2002:a50:e1c4:: with SMTP id m4mr50255750edl.307.1634041411047; Tue, 12 Oct 2021 05:23:31 -0700 (PDT) MIME-Version: 1.0 References: <42A19672-C6EF-4C2F-A826-4CB9EE388B95@gmail.com> In-Reply-To: From: Richard Biener Date: Tue, 12 Oct 2021 14:23:19 +0200 Message-ID: Subject: Re: [PATCH] hardened conditionals To: Alexandre Oliva Cc: Alexandre Oliva via Gcc-patches Content-Type: text/plain; charset="UTF-8" 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, 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, 12 Oct 2021 12:23:33 -0000 On Tue, Oct 12, 2021 at 8:35 AM Alexandre Oliva wrote: > > On Oct 9, 2021, Richard Biener wrote: > > > Why two passes (and two IL traverses?) > > Different traversals, no reason to force them into a single pass. One > only looks at the last stmt of each block, where cond stmts may be, > while the other has to look at every stmt. > > > How do you prevent RTL optimizers (jump threading) from removing the > > redundant tests? > > The trick I'm using to copy of a value without the compiler's knowing > it's still the same value is 'asm ("" : "=g" (alt) : "0" (src));' > > I've pondered introducing __builtin_hidden_copy or somesuch, but it > didn't seem worth it. I see. I remember Marc using sth similar initially when trying to solve the FENV access problem. Maybe we indeed want to have some kind of more generic "dataflow (optimization) barrier" ... Are there any issues with respect to debugging when using such asm()s? > > I'd have expected such hardening to occur very late in the RTL > > pipeline. > > Yeah, that would be another way to do it, but then it would have to be a > lot trickier, given all the different ways in which compare-and-branch > can be expressed in RTL. Agreed, though it would be less disturbing to the early RTL pipeline and RTL expansion. > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Disinformation flourishes because many people care deeply about injustice > but very few check the facts. Ask me about