From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BB9263858C5E for ; Mon, 7 Nov 2022 09:08:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB9263858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667812126; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=AG/y6/XIeWQGHE9QH2ljYoITfg6cFvfP+guLt1tFQjE=; b=MCoteHV8oGS6sN/WtCyVkuHnY+m1ssRSGgHRFYzi97XOEPCMyNTzM8134heU/hJ4HaiWFa 8ArwW4m+wn7ll46p47V5TSBaA4Z4WT8r5jMNjw9U/gFc3qnQAVdbCVPiEQcrzpKa77+S0z r2AhPAUt0cKvn2FLyL0kodUN1fKCZjw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-cASrRHIRM0Sya8QLdu4q8Q-1; Mon, 07 Nov 2022 04:08:44 -0500 X-MC-Unique: cASrRHIRM0Sya8QLdu4q8Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 877793C10144; Mon, 7 Nov 2022 09:08:44 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 434A4140EBF5; Mon, 7 Nov 2022 09:08:44 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2A798f9X368450 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 7 Nov 2022 10:08:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2A798eA9368449; Mon, 7 Nov 2022 10:08:40 +0100 Date: Mon, 7 Nov 2022 10:08:40 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][RFC] tree-optimization/107389 - use __builtin_assume_alignment at -O0 Message-ID: Reply-To: Jakub Jelinek References: <20221107090211.E59EA13494@imap2.suse-dmz.suse.de> MIME-Version: 1.0 In-Reply-To: <20221107090211.E59EA13494@imap2.suse-dmz.suse.de> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no 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 Mon, Nov 07, 2022 at 10:02:11AM +0100, Richard Biener wrote: > The following adds a fold_builtins pass at -O0, keying off some > unwanted optimization and setting pointer alignment of the result > of __builtin_assume_alignment before removing the call. This > allows libatomic calls to be elided at -O0 on s390 for > > __uint128_t foo(__uint128_t *p) > { > return __atomic_load_n((__uint128_t *)__builtin_assume_aligned (p, 16), 0); > } > > not sure how to reliably test this though. > > Thoughts? Do we really need a separate pass for it? Can't we do it say during gimplification? > PR tree-optimization/107389 > * tree-pass.h (pass_fold_builtins_O0): Declare. > * passes.def (pass_fold_builtins_O0): Schedule. > * tree-ssa-ccp.cc (pass_fold_builtins_O0): Define. > (pass_fold_builtins): Template, add gate. > (pass_fold_builtins::execute): Apply alignment to the > target of __builtin_assume_aligned at -O0. Disable most > optimizations for the -O0 pass instance. Jakub