From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by sourceware.org (Postfix) with ESMTPS id 207EA3858C55 for ; Thu, 14 Jul 2022 14:04:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 207EA3858C55 Received: by mail-pj1-f47.google.com with SMTP id b8so2947430pjo.5 for ; Thu, 14 Jul 2022 07:04:34 -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=LaD0iT8UlshRM6FsKlSqVSySIRY+WsanIDRRhpatXXg=; b=Fje72QHH3OWtM4ANCmIXSXilmD2nFpF8Xzpb+AONMOAkBRIoFPpyqwewsVgykIZj1k 7N/1zaezDc6H/oDYOdxDC3jY0BbOMz869wTWUJyVFQMqLSQck7Jt4/9oF4cTVezHez9m PaYK8taoxyc4AsGeqQOAaC+VKsdsfe93Uk3Z4tSvLlyt+0j/4ecVRRukiXJ1c6VcILds 8usln1Bs9sfBOlDdz0oPUQrruNP2dIbK+INlWN93pvaadaIihcrgEZgjjADO8wj07Dw1 rZvc+fdrt4XPAV5HW0v/XkBvj5znOIv2KelBLjnUOnv6VIiZyrGiu8KOhj5snAXTnkv4 nj2g== X-Gm-Message-State: AJIora8tCCkWdhQXtUoQwQZtf+AU79SjfrwMdQr3rneTkOURWTZL7M3W z4XGLZzfxp1swHjKColUupxN6ufljijmVA== X-Google-Smtp-Source: AGRyM1uvIK9VHjGXj+bVCdb9fBcLH26niH+Zd7T/R0DSfn6l1qBPCdbdOpLIAhDk154B2ORsGDLezQ== X-Received: by 2002:a17:90b:33ce:b0:1ef:e5f4:f8e2 with SMTP id lk14-20020a17090b33ce00b001efe5f4f8e2mr16974147pjb.70.1657807471885; Thu, 14 Jul 2022 07:04:31 -0700 (PDT) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com. [209.85.215.170]) by smtp.gmail.com with ESMTPSA id y184-20020a6264c1000000b00528d7d27211sm1719759pfb.178.2022.07.14.07.04.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jul 2022 07:04:31 -0700 (PDT) Received: by mail-pg1-f170.google.com with SMTP id s206so1648095pgs.3 for ; Thu, 14 Jul 2022 07:04:31 -0700 (PDT) X-Received: by 2002:a65:6bc4:0:b0:3c2:2f7c:cc74 with SMTP id e4-20020a656bc4000000b003c22f7ccc74mr7691940pgw.307.1657807471079; Thu, 14 Jul 2022 07:04:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Erick Ochoa Date: Thu, 14 Jul 2022 16:08:33 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Creating a wrapper around a function at compile time To: Richard Biener Cc: GCC Development X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2022 14:04:36 -0000 On Thu, 14 Jul 2022 at 15:51, Richard Biener wrote: > With a value-profile it would be per call site and IPA-CP can use that > to direct the cloning. I'm not sure how many > values a value histogram can track reliably here. > Last time I checked, value profiling can only track a single value per statement. So that would need to be augmented if we wanted to specialize for more than one parameter. However, this can also be a bad idea. Because even if parameters a and b are quasi-constants, perhaps the cross product a x b follows a more uniform distribution. This means that optimizing on a or on b might be a good idea but optimizing on a x b is a bad idea. (There is still some work to be done defining when specializing is a good idea or not). Also, I do not believe that value profiling profiles arguments? According to the comments only values regarding division and/or indirect/virtual call specialization are tracked during value profiling. However, even if value profiling would be a great addition to this, I would like to explore the transformation independent of value profiling. There are some heuristics that could be used, for example looking at the callsites which do have constant arguments and which optimizations are enabled by those constants. You mention that: "IPA-CP can use that to direct the cloning". Can you elaborate a bit further? I guess the idea here is augmenting ipa-cp with a list of "likely values" and extend the infrastructure which deals with speculation to support arguments. Am I following correctly? Any other suggestions?