Message ID | CAGWvnyn+9it7njcqXNudgbVRF3rRMPwOz7FjC4SjxziVsK8EcA@mail.gmail.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83236385AC27 for <patchwork@sourceware.org>; Thu, 18 Nov 2021 18:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83236385AC27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637260738; bh=Rr8dygjhLRsX4fy4YDlJwb+haP0Xd8BTcOw1wJmRlvc=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eZXq4zH9srFhozBmEpqQYH9XRKSWOqsDP8mAF5b2mK7EwAZgsqISqD9zPFK+S4cRA H6AG1bkhpgnEx5glhf08WuLJ8Eg2E7XnqpkbFOkk36UDX/U0vDKdOK2oMpSYD2qtHy nkqDHUsmZ9mbnjfO2C5hrcsW54lHdkSEVB2GzUl4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-vk1-xa2d.google.com (mail-vk1-xa2d.google.com [IPv6:2607:f8b0:4864:20::a2d]) by sourceware.org (Postfix) with ESMTPS id 8D74A3858422 for <gcc-patches@gcc.gnu.org>; Thu, 18 Nov 2021 18:38:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D74A3858422 Received: by mail-vk1-xa2d.google.com with SMTP id e27so1436802vkd.4 for <gcc-patches@gcc.gnu.org>; Thu, 18 Nov 2021 10:38:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Rr8dygjhLRsX4fy4YDlJwb+haP0Xd8BTcOw1wJmRlvc=; b=wCBVszQxc1nE4n+jdecx4rE/ff5ANb8PpUGpkhMZOrYAUXdMlSsRfftw8eeMYTlUI5 tKZ3cY4RCMGZZyc6dIYo1xwxVLihbxWC9a6U/RjSpVVCIw8EuKZ+mk66+HB11CrfJz3N SeggMioTjhyOKGy8mAzp5UzrgHyN8N/hLMv+mJ86+S3JcQtsIUPBvOPzTVuFz8tAJXcz 9r5yl40vXYPGUPUwVWKFFdKdnjFNsLZytxO863Xa4UTMsG1hV5YYTzqopBsTOTtHpKP7 QkaeGrtaEpuMM1mcBhDDGvDxEbdEMo5MxeXqqJMvChlhY2r1/KUOo+U3oWxt+udzLHNV AbDA== X-Gm-Message-State: AOAM532i813JvO5gR2wTSJZrGm7jntco02/lg4imotgiF2ofk41ccGmd o/WRjv6lXEllc3CFpdP+olFRY92SIkegSEsg1qyWESuZgFA= X-Google-Smtp-Source: ABdhPJykV1gx65c3ipHdwwgM/jJ7p8J+8bRv0G0OthB2pp1XAbecA6lRQQUSuzXpPF/oyt88mdJ4F1WmOn6/YoQzqD0= X-Received: by 2002:a05:6122:221f:: with SMTP id bb31mr107086826vkb.23.1637260708874; Thu, 18 Nov 2021 10:38:28 -0800 (PST) MIME-Version: 1.0 Date: Thu, 18 Nov 2021 13:37:31 -0500 Message-ID: <CAGWvnyn+9it7njcqXNudgbVRF3rRMPwOz7FjC4SjxziVsK8EcA@mail.gmail.com> Subject: [PATCH] Fix rs6000 predicates.md use of decl_replaceable_p To: GCC Patches <gcc-patches@gcc.gnu.org> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_STOCKGEN, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Level: ** 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: David Edelsohn via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: David Edelsohn <dje.gcc@gmail.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Fix rs6000 predicates.md use of decl_replaceable_p
|
|
Commit Message
David Edelsohn
Nov. 18, 2021, 6:37 p.m. UTC
|| DEFAULT_ABI == ABI_ELFv2) && (SYMBOL_REF_EXTERNAL_P (op)
Comments
> --- a/gcc/config/rs6000/predicates.md > +++ b/gcc/config/rs6000/predicates.md > @@ -1086,7 +1086,9 @@ (define_predicate "current_file_function_operand" > (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) > && (SYMBOL_REF_LOCAL_P (op) > || (op == XEXP (DECL_RTL (current_function_decl), 0) > - && !decl_replaceable_p (current_function_decl))) > + && !decl_replaceable_p (current_function_decl, > + opt_for_fn > (current_function_decl, > + > flag_semantic_interposition)))) Thanks, missed the use of the predicate here. However it is not clear to me why one would care about semantic interposition at this level. It seems to me that one more cares whether the symbol must be always resolved locally. In this case cgraph_node::get (current_function_decl)->binds_to_current_def_p (cgraph_node::get (current_function_decl)) would give right answer (and work for cases like functions in comdat groups) Honza > && !((DEFAULT_ABI == ABI_AIX > || DEFAULT_ABI == ABI_ELFv2) > && (SYMBOL_REF_EXTERNAL_P (op)
On Thu, Nov 18, 2021 at 2:07 PM Jan Hubicka <hubicka@kam.mff.cuni.cz> wrote: > > > --- a/gcc/config/rs6000/predicates.md > > +++ b/gcc/config/rs6000/predicates.md > > @@ -1086,7 +1086,9 @@ (define_predicate "current_file_function_operand" > > (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) > > && (SYMBOL_REF_LOCAL_P (op) > > || (op == XEXP (DECL_RTL (current_function_decl), 0) > > - && !decl_replaceable_p (current_function_decl))) > > + && !decl_replaceable_p (current_function_decl, > > + opt_for_fn > > (current_function_decl, > > + > > flag_semantic_interposition)))) > > Thanks, missed the use of the predicate here. > However it is not clear to me why one would care about semantic > interposition at this level. It seems to me that one more cares whether > the symbol must be always resolved locally. In this case > cgraph_node::get (current_function_decl)->binds_to_current_def_p (cgraph_node::get (current_function_decl)) > would give right answer (and work for cases like functions in comdat groups) Hi, Honza I was trying to fix bootstrap as quickly as possible and used the best example that I could find. It definitely can be refined. Thanks for suggesting a better design. I'll test it. Thanks, David > > Honza > > && !((DEFAULT_ABI == ABI_AIX > > || DEFAULT_ABI == ABI_ELFv2) > > && (SYMBOL_REF_EXTERNAL_P (op)
> On Thu, Nov 18, 2021 at 2:07 PM Jan Hubicka <hubicka@kam.mff.cuni.cz> wrote: > > > > > --- a/gcc/config/rs6000/predicates.md > > > +++ b/gcc/config/rs6000/predicates.md > > > @@ -1086,7 +1086,9 @@ (define_predicate "current_file_function_operand" > > > (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) > > > && (SYMBOL_REF_LOCAL_P (op) > > > || (op == XEXP (DECL_RTL (current_function_decl), 0) > > > - && !decl_replaceable_p (current_function_decl))) > > > + && !decl_replaceable_p (current_function_decl, > > > + opt_for_fn > > > (current_function_decl, > > > + > > > flag_semantic_interposition)))) > > > > Thanks, missed the use of the predicate here. > > However it is not clear to me why one would care about semantic > > interposition at this level. It seems to me that one more cares whether > > the symbol must be always resolved locally. In this case > > cgraph_node::get (current_function_decl)->binds_to_current_def_p (cgraph_node::get (current_function_decl)) > > would give right answer (and work for cases like functions in comdat groups) > > Hi, Honza > > I was trying to fix bootstrap as quickly as possible and used the best > example that I could find. It definitely can be refined. Sure, having bootstrap working is good - sorry for missing update here. > > Thanks for suggesting a better design. I'll test it. It really depends what current_file_function_operand means. If it is supposed to check that it is a function that is defined in current file and always will bind to it, then node->binds_to_current_def_p is good a right thing to test and you don't need to restrict it to current function decl. node->binds_to_current_def_p (node2) returns true if refernces from node2 to node will always bind to the deifnition you are seeing. So - node2 is cgraph_node::get (current_function_ecl) - node is the symbol OP refers to (accessible by cgraph_node::get (SYMBOL_REF_DECL (op)) I think but you will likely need to watch for possible NULLs) Note that with LTO this will rturn true even if node2 is in different partition (and thus different object file). If you do not want that you need to additionally check && !node->in_other_partition. Honza > > Thanks, David > > > > > Honza > > > && !((DEFAULT_ABI == ABI_AIX > > > || DEFAULT_ABI == ABI_ELFv2) > > > && (SYMBOL_REF_EXTERNAL_P (op)
--- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -1086,7 +1086,9 @@ (define_predicate "current_file_function_operand" (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) && (SYMBOL_REF_LOCAL_P (op) || (op == XEXP (DECL_RTL (current_function_decl), 0) - && !decl_replaceable_p (current_function_decl))) + && !decl_replaceable_p (current_function_decl, + opt_for_fn (current_function_decl, + flag_semantic_interposition)))) && !((DEFAULT_ABI == ABI_AIX