Failing in generated file options.c

2021-03-16 Thread Erick Ochoa via Gcc
Hi Gary, the options.c file is generated from the gcc/common.opt file. Report was a keyword that could be given to optimization options but which was dropped sometime in December I think. The patches I sent you should have the keyword Report dropped. Are you applying your sources already? If not,

Question on special constraint variables in points-to analysis

2021-03-16 Thread Erick Ochoa via Gcc
Hello, I'm currently working on improving my understanding of the implementation of the intraprocedural points-to analysis in GCC. I have already read the papers by Daniel Berlin and have been looking at the source for some time, but I understand that those references are a little bit old and migh

More questions on points-to analysis

2021-03-17 Thread Erick Ochoa via Gcc
Hello, I'm still trying to compare the solution generated from the intraprocedural points-to analysis in GCC against an external solver. Yesterday it was pointed out that "NULL is not conservatively correctly represented in the constraints". Can someone expand on this? To me this sounds like a co

Re: More questions on points-to analysis

2021-03-17 Thread Erick Ochoa via Gcc
Hi Richard, I think I misunderstood yesterday's answer and deviated a little bit. But now I want to focus on this: > > * the process in GCC that generates the constraints for NULL works > > fine (i.e., feeding the constraints generated by GCC to an external > > solver should yield a conservatively

Re: More questions on points-to analysis

2021-03-17 Thread Erick Ochoa via Gcc
Mm... ignore this for now please, I think I messed up the analysis by hand. I will try again. Thanks! On Wed, 17 Mar 2021 at 16:16, Erick Ochoa wrote: > > Hi Richard, I think I misunderstood yesterday's answer and deviated a > little bit. But now I want to focus on this: > > > > * the process in

Re: More questions on points-to analysis

2021-03-17 Thread Erick Ochoa via Gcc
No, I think it is correct. Any help would be clearly appreciated. Thanks! (Even if I'm wrong, of course I'd like to know.) On Wed, 17 Mar 2021 at 17:21, Erick Ochoa wrote: > > Mm... ignore this for now please, I think I messed up the analysis by > hand. I will try again. Thanks! > > On Wed, 17 Ma

Re: More questions on points-to analysis

2021-03-18 Thread Erick Ochoa via Gcc
Perfect, thank you! This is exactly the answer that I was looking for. On Thu, 18 Mar 2021 at 13:27, Richard Biener wrote: > > On Wed, Mar 17, 2021 at 4:17 PM Erick Ochoa wrote: > > > > Hi Richard, I think I misunderstood yesterday's answer and deviated a > > little bit. But now I want to focus

Re: More questions on points-to analysis

2021-03-19 Thread Erick Ochoa via Gcc
Hello Richard, I have a related question. I have the following GCC program (which is again an altered version of ipa-pta-16.c: ``` struct X { long l1; struct Y { long l2; int *p; } y; }; int i; static int __attribute__((noinline)) foo (struct X *x) { struct Y y = x->y;

Question about reading LTO function summaries

2021-03-26 Thread Erick Ochoa via Gcc
Hello, I already have some experience developing SIMPLE_IPA_PASSes, but I am looking to understand IPA_PASSes better. I have made a hello world ipa pass that stores "hello world $FUNCTION_NAME" in the function summaries; however, I am having trouble reading this information back. Can someone help

Re: Question about reading LTO function summaries

2021-03-30 Thread Erick Ochoa via Gcc
Hello, just trying again to increase visibility of this question. Many thanks in advance! On Fri, 26 Mar 2021 at 13:49, Erick Ochoa wrote: > > Hello, > > I already have some experience developing SIMPLE_IPA_PASSes, but I am > looking to understand IPA_PASSes better. I have made a hello world ip

Question about points-to analysis, global variables, IPA, and field sensitivity

2021-03-30 Thread Erick Ochoa via Gcc
Hi, I am looking at the points-to analysis in GCC and I found the following comment in tree-ssa-structalias.c: /* Collect field information. */ if (use_field_sensitive && var_can_have_subvars (decl) /* ??? Force us to not use subfields for globals in IPA mode. Else we'd

Re: Question about points-to analysis, global variables, IPA, and field sensitivity

2021-03-30 Thread Erick Ochoa via Gcc
> If the global is module local we should initialize it with NULL, yes. If it > is > not module local it should be initialized with NONLOCAL (that's both what > should currently happen correctly - it's needed for non-field-sensitive init > as well). > Awesome, thanks Richard! One more question:

Re: Question about reading LTO function summaries

2021-04-01 Thread Erick Ochoa via Gcc
Hello, just trying one more time. Any direction or hint is appreciated. Just as a note, I looked at the ipa-devirt as an inspiration for these small functions I wrote, but for some reason I can't read what I assume have written to the summaries. (What I'm trying to do is simply use LTO using a rea

Question on changing IPA-PTA to an IPA_PASS

2021-04-01 Thread Erick Ochoa via Gcc
Hi, just a high level question. I know that IPA-PTA is a SIMPLE_IPA_PASS and that ideally it would be better as an IPA_PASS. I understand that one of the biggest challenges of changing IPA-PTA to an IPA_PASS is that on the current LTO framework, the LTRANS stage can happen at the same time for mul

Re: Question on changing IPA-PTA to an IPA_PASS

2021-04-01 Thread Erick Ochoa via Gcc
> > I don't think this would remove any problem that is present. > I have a problem understanding what you mean here because later on you state: > Now - the reason you think of is likely that IPA transform will instantiate > IPA clones and do inlining and transfering the IPA PTA solution to the >

Re: Question about reading LTO function summaries

2021-04-06 Thread Erick Ochoa via Gcc
pa_free_lang_data (gcc::context *ctxt); extern simple_ipa_opt_pass *make_pass_ipa_free_fn_summary (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_hello_world (gcc::context *ctxt); extern ipa_opt_pass_d *make_pass_ipa_cp (gcc::context *ctxt); extern ipa_opt_pass_d *make_pass_ipa_sra

Late SIMPLE_IPA_PASS, DECL_INITIAL and error mark nodes

2021-06-11 Thread Erick Ochoa via Gcc
Hi, I am looking for a small clarification. I understand that during late SIMPLE_IPA_PASSes some statically initialized global variables might have error_mark_node trees in their DECL_INITIAL field. I believe that I read something similar in the past about how to get the tree expressions in these

Semantics of OBJ_TYPE_REF

2021-06-18 Thread Erick Ochoa via Gcc
Hi, I am having some trouble understanding the semantics of OBJ_TYPE_REF. I understand that it is made of three operands: 1. OBJ_TYPE_REF_EXPR: An expression that evaluates the value to use. 2. OBJ_TYPE_REF_OBJECT: Is the object on whose behalf the lookup is being performed 3. OBJ_TYPE_REF_TOKEN:

Re: Semantics of OBJ_TYPE_REF

2021-06-23 Thread Erick Ochoa via Gcc
Cool, thanks! I think I understand now. On Tue, 22 Jun 2021 at 23:58, Martin Jambor wrote: > > Hi, > > On Fri, Jun 18 2021, Erick Ochoa via Gcc wrote: > > Hi, > > > > I am having some trouble understanding the semantics of OBJ_TYPE_REF. > > I understa

Why does printing a pointer cause it to escape?

2021-06-23 Thread Erick Ochoa via Gcc
Hello, I know that some BUILT_IN functions are treated in a special way by the points-to analysis. Those functions are those that take pointers as arguments or return them but do not change their points-to set and similar cases. (E.g. strcpy returns a pointer to the same object as their first argu

Re: Why does printing a pointer cause it to escape?

2021-06-23 Thread Erick Ochoa via Gcc
> I guess that to assume otherwise, one would have to make sure the > pointer does not correspond to a "%n" (or similar, perhaps even future) > conversion specifier. > Oh, wow, I didn't know about the %n specifier. Thanks Martin!

Re: Why does printing a pointer cause it to escape?

2021-06-23 Thread Erick Ochoa via Gcc
Hi Liu, thanks, this also seems correct. I originally thought that (in your example) ptr would be marked as pointing to { ESCAPE NONLOCAL } and that would be enough to hinder some optimizations that might influence variable value. Therefore, it wasn't necessary to mark "value" as pointing to { ESC

Unique identifier across different partitions (LTO)

2021-06-29 Thread Erick Ochoa via Gcc
Hello, I'm trying to generate unique identifiers for some trees at link time. I understand that there are already some unique identifiers in declarations (DECL_UID) and perhaps others. Do all trees have unique identifiers or only declarations? Alternatively, if they don't have unique identifiers,

How to get the global namespace (DECL_CONTEXT) at LTO during LGEN?

2021-06-30 Thread Erick Ochoa via Gcc
Hello, I am wondering if there's a way to get the global namespace at LTO during LGEN in each of the partitions being processed. I believe that during parse time for c/c++ there is a global_namespace macro or variable that can be used, but I don't think that it is possible to use at link time. Th

Are DECL_UIDs for the same across partitions during LGEN?

2021-06-30 Thread Erick Ochoa via Gcc
Hi, I am still working on understanding the LTO framework and how the gimple representation works across multiple partitions. I found myself printing all global variables and printing their DECL_UID. I noticed that for some variables, their DECL_UIDs were different across different partitions. Tha

Re: Are DECL_UIDs for the same across partitions during LGEN?

2021-06-30 Thread Erick Ochoa via Gcc
On Wed, 30 Jun 2021 at 17:06, Richard Biener wrote: > > On June 30, 2021 4:07:00 PM GMT+02:00, Erick Ochoa via Gcc > wrote: > >Hi, > > > >I am still working on understanding the LTO framework and how the > >gimple representation works across multiple partition

How to dump_decl_name to a string instead to a file?

2021-07-01 Thread Erick Ochoa via Gcc
Hello, I have a function that looks at identifiers of formal parameters. I found that when I ran this function on larger projects, the compiler segfaulted. I looked into this and I found that there are some formal parameters which have NULL in their DECL_NAME and that triggered a NULL dereference.

tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-07 Thread Erick Ochoa via Gcc
Hi, I am saving some tree declarations during LGEN that I will be later analyzing at WPA time. I am able to read the decl from my summaries and print it at WPA time. It corresponds to a global variable. However, whenever I use symtab_node::get (decl) during WPA time I keep getting NULL. Does anyo

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-09 Thread Erick Ochoa via Gcc
Hi, I noticed this is also happening also for local variables. Again, storing tree declarations on a summary during LGEN and then at WPA time reading from those summaries. I can print the declaration, but when I try to look for its node in the symtab I get NULL as the return value. Any help is app

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-12 Thread Erick Ochoa via Gcc
> I'm not too familiar with it but I think you're supposed to stream encoded > symtab references during LGEN/WPA, Thanks Richard, this happened to be the solution. I am now using lto_symtab_encoder_t to encode the declarations during LGEN and decode them during WPA. Are there any more limitations

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-13 Thread Erick Ochoa via Gcc
Hi, Just to clarify a similar question: I am using stream_write_tree and looking at the comments it says that it is assumed that the tree T is already in the encoder cache. Does this mean that I have to use lto_symtab_encoder_t for all trees I want to store in summaries? I thought the encoder only

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-13 Thread Erick Ochoa via Gcc
> There are entities, like SSA names and STRING_CSTs which are specially > encoded and if you stream those in your LGEN data you have to set up > appropriate encoders. In general streaming arbitrary trees isn't the > best thing to do, usually you're interested in specific pieces only. That's > es

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-13 Thread Erick Ochoa via Gcc
On Tue, 13 Jul 2021 at 11:41, Richard Biener wrote: > There are entities, like SSA names and STRING_CSTs which are specially > encoded and if you stream those in your LGEN data you have to set up > appropriate encoders. I forgot to ask, is there an example of these appropriate encoders being use

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-14 Thread Erick Ochoa via Gcc
> I guess the way to encode SSA trees would be to use sth like a > , SSA-version tuple much like PTA internally > uses the varinfo array index as identifier for the variables in the > constraints. For local decls (as opposed to SSA names) it's a bit > more difficult - you'd have to devise your own

tree that is both SSA_VAR_P and DECL_P?

2021-07-15 Thread Erick Ochoa via Gcc
Hi, I was sorting SSA trees and DECL_P trees into different buckets. I used DECL_P as a proxy for it being a local/global variable/function (essentially a declaration). It seems that "probabilistically", I'm kinda right. Normally there is no tree that is both an SSA_VAR_P and a DECL_P at the same

Re: tree that is both SSA_VAR_P and DECL_P?

2021-07-15 Thread Erick Ochoa via Gcc
Thanks! I'll have to see what conditions led to everything working before and change them to meet reality. On Thu, 15 Jul 2021 at 10:35, Richard Biener wrote: > > On Thu, Jul 15, 2021 at 10:22 AM Erick Ochoa via Gcc wrote: > > > > Hi, > > > > I was sort

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-21 Thread Erick Ochoa via Gcc
Hello Richard, I need a little bit more help. In our previous messages you mentioned "" > > > > > I guess the way to encode SSA trees would be to use sth like a > > > , SSA-version tuple much like PTA internally > > > uses the varinfo array index as identifier for the variables in the > > > constr

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-22 Thread Erick Ochoa via Gcc
> > If this is the case, I can indeed get the varpool node's at WPA time > > (as shown above), but comparing their pointer addresses will be > > distinct. How can one find out that two varpool nodes/cgraph nodes are > > the same at WPA time? Is just looking at the assembler name enough? I > > of co

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-22 Thread Erick Ochoa via Gcc
> > fopen $PID1 8 $ADDR1 > fopen $PID2 7 $ADDR2 > Just to clarify a bit further. $PID is generated and stored during LGEN. The encoding is obviously generated during LGEN. These are read during WPA. And the encoding is decoded and dyn_casted into a cgraph_node at WPA time. All these are printed du

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-22 Thread Erick Ochoa via Gcc
> > > 1. pid of lgen process that generated the encoding > > > 2. index returned by lto_symtab_encoder_encode > > > 3. varpool_node->name () > > > 4. the pointer address being pointed by varpool node > > Well, yes, during LGEN no WPA has run. Do you mean LTRANS after WPA? > Sure, the encoder numbe

Re: tree decl stored during LGEN does not map to a symtab_node during WPA

2021-07-22 Thread Erick Ochoa via Gcc
> > But the addresses are at LGEN time? The following is what runs at WPA time unsigned long pid = streamer_read_uhwi (&ib); unsigned long id = streamer_read_uhwi (&ib); lto_symtab_encoder_t encoder = file_data->symtab_node_encoder; cgraph_node *cnode = dyn_cast(lto_symtab_encoder_deref(encoder,

Can someone help me understand cgraph_nodes & cgraph_edges during WPA

2021-07-23 Thread Erick Ochoa via Gcc
Hello, I've been working on an LTO points-to analysis pass for a little while. Because of LTO's design, gimple bodies are inaccessible during WPA. This essentially means that every LTO pass compiles down function bodies into their own IR which gets stored in function summaries and later read durin

Question about finding parameters in function bodies from SSA variables

2021-08-05 Thread Erick Ochoa via Gcc
Hello Richard, I'm still working on the points-to analysis and I am happy to say that after reviewing the ipa-cp code I was able to generate summaries for local variables, ssa variables, heap variables, global variables and functions. I am also using the callback hooks to find out if cgraph_nodes

Some questions on hash_set/hash_map traits

2021-09-08 Thread Erick Ochoa via Gcc
Hello, I am refactoring some old code that runs as an IPA_PASS. This code is intended to run at link-time using the LTO framework and so I am always testing it that way. At the moment, I am trying to use hash-maps but having some difficulties. I am adding some patches that will help illustrate alo

Re: Can gcc itself be tested with ubsan? If so, how?

2021-09-27 Thread Erick Ochoa via Gcc
Hi, just as a note. This is also of interest to me. I have wanted to compile a single pass that I wrote using ubsan/other sanitizers for testing purposes. I was wondering if someone has already modified the build system to use ubsan to test their passes and if they could document the process for d

Question about symtab_node::order during LTO

2021-10-12 Thread Erick Ochoa via Gcc
Hi, I have an LTO pass which stores information collected during "generate function summary" in a map which is symtab_node* -> data*. I know that the symtab_node*s are encoded by an lto encoder and can be decoded back during the "read function summary". I also am aware that other optimizations mig

Question about semantics of cgraph_node::prevailing_p

2021-10-13 Thread Erick Ochoa via Gcc
Hi, My current understanding of LTO is that the callgraph is very dynamic (i.e., optimizations might add or remove cgraph_nodes). A while back I encountered an issue where I couldn't print the cgraph_node::name of a function during the execute stage in LTO. I found that the only thing different wa

Question on calling possible_polymorphic_call_targets, side effects, and virtual tables.

2021-10-27 Thread Erick Ochoa via Gcc
Hello, I have a SIMPLE_IPA_PASS that parses the program multiple times. As it parses gimple, it builds a data structure with the information collected that will provide some invariants to future iterations over the program. I was looking into adding a new feature that would take advantage of devi

How to run C++ IPA tests?

2021-10-27 Thread Erick Ochoa via Gcc
Hi, I have been adding tests to the gcc/testsuite/gcc.dg/ipa folder successfully for a while now. I am starting to add some tests into gcc/testsuite/g++.dg/ipa now but I am having some issues. 1. Using `make check-g++` returns the following error message "No rule to make target 'check-g++'". 2. W

Question on cgraph_node::force_output

2021-11-02 Thread Erick Ochoa via Gcc
Hi, I am looking at tree-ssa-structalias.c looking at what makes a function nonlocal during IPA-PTA. I am having some problems understanding force_output and when it is set or unset. 1. What is the meaning of force_output? cgraph.h gives an example that force output means that the symbol might be

Question on ipa_ref->referring and ipa_ref->stmt on all_late_ipa_passes

2022-02-14 Thread Erick Ochoa via Gcc
Hi, I would like to use ipa_ref in the PASS_LIST all_late_ipa_passes to query the statement (ref->stmt) of where a global variable is used. However, I am having some problems achieving this. What I do is: 1. Check that ipa_ref->referring has a body and is not inlined. 2. get_body 3. try to print

Re: Question on ipa_ref->referring and ipa_ref->stmt on all_late_ipa_passes

2022-02-14 Thread Erick Ochoa via Gcc
On Mon, 14 Feb 2022 at 10:57, Jan Hubicka wrote: > > Hi, > > > > I would like to use ipa_ref in the PASS_LIST all_late_ipa_passes to query > > the statement (ref->stmt) of where a global variable is used. However, I > am > > having some problems achieving this. > > > > What I do is: > > > > 1. Ch

Question on ipa-bit-cp and pointer_plus_expr

2022-02-17 Thread Erick Ochoa via Gcc
Hello, I'm trying to understand ipa-bit-cp/ipa-cp and how the known bits are propagated to the lattice in the case of a pointer_plus_expr. I have a piece of code similar to the following (this being a simplified example) int main () { // a = some pointer. foo (a); } foo (void* a) { bar (a

Re: Question on ipa-bit-cp and pointer_plus_expr

2022-02-17 Thread Erick Ochoa via Gcc
at the static information available at the argument and not the parameter? Thanks! On Thu, 17 Feb 2022 at 17:25, Martin Jambor wrote: > Hi, > > On Thu, Feb 17 2022, Erick Ochoa via Gcc wrote: > > Hello, > > > > I'm trying to understand ipa-bit-cp/ipa-cp and how the

Re: Question on ipa-bit-cp and pointer_plus_expr

2022-02-17 Thread Erick Ochoa via Gcc
> If I understand you correctly, that is indeed the jump function, > obtainable through ipa_get_ith_jump_func (args, i) where args is a > result of ipa_edge_args_sum->get and i is the index of the parameter. > Thanks Martin! So then, am I correct in thinking that callsite foo -> bar param 0: PAS

ASSERT_EXPR during SIMPLE_IPA_PASS and LTO

2022-03-01 Thread Erick Ochoa via Gcc
Hi, I am working on an analysis that is able to determine some static information about a specific variable. At the moment, I would like to avoid much of the transformation by taking advantage of other GCC's passes. So, I can imagine something like, create an ASSERT_EXPR and let other passes chang

Question on updating function body on specialized functions

2022-03-08 Thread Erick Ochoa via Gcc
Hi, I have one function (F) that has been specialized for two different calling contexts (F1 and F2) and two late SIMPLE_IPA_PASSes (A and B). Pass A changes some MEM_REFs such that the type of MEM_REF is compatible with the type of the first operand of the expression. Pass A changes both F1 and F

Re: Question on updating function body on specialized functions

2022-03-08 Thread Erick Ochoa via Gcc
Hi Martin! Thanks for replying, turns out that while I was trying to reply to you I was able to get the answer. Turns out there is indeed one tree node which is shared across the two functions. And that is TREE_OPERAND (MEM_REF, 1). When I was assigning to TREE_TYPE ( TREE_OPERAND (MEM_REF, 1)

Question on mapping old to specialized cgraph_edges

2022-03-09 Thread Erick Ochoa via Gcc
Hi, I am trying to find a map between cgraph_edge*s before ipa-cp and after ipa-cp has specialized nodes. Does anyone know if such a map is available? Or an equivalent? I think technically it should be a map between: (cgraph_node* caller, cgraph_edge* e, cgraph_node *callee) X (cgraph_node* calle

Question on not sharing trees (tree_node_can_be_shared)

2022-03-21 Thread Erick Ochoa via Gcc
Hi, I am interested in annotating INTEGER_CSTs. I have added a field to typed_trees and set the value in some cases. However, INTEGER_CSTs can be shared and copied across the function and even copied to other functions. I don't want all INTEGER_CSTs with the same value to be shared as now they hav

Question on path from C parser to DECL_INITIAL

2022-03-23 Thread Erick Ochoa via Gcc
Hi, I am trying to understand what path is executed in GCC from parsing a C expression (in a global variable declaration) to the value in DECL_INITIAL. At the moment, I have annotated a tree during parsing. I have another debugging pass that looks for this tree in subsequent passes. The annotation

Re: Question on path from C parser to DECL_INITIAL

2022-03-23 Thread Erick Ochoa via Gcc
> I'm not sure I understand but no pass walks 'global variables', so you're > not > going to "see" the annotation from passes (whatever that means). > > What I mean by walking global variables is that I have a GIMPLE_PASS that ignores the function sent as an argument and instead just uses a FOR_EAC

Question on cgraph_edge::call_stmt during LTO

2022-05-20 Thread Erick Ochoa via Gcc
Hi, I'm working on a pass that looks into the estimated values during ipa-cp and stores them for a later analyses/pass. I would like to store the real arguments' estimates in a cgraph_edge::call_stmt or somewhere else that makes similar sense. (Note, this is different from the formal parameters' e

Re: Question on cgraph_edge::call_stmt during LTO

2022-06-02 Thread Erick Ochoa via Gcc
o update the cgraph_edge that disappears when dst->caller is inlined to its caller? * something else? Any direction is greatly appreciated! Many thanks! -Erick On Sat, 21 May 2022 at 00:13, Martin Jambor wrote: > Hello, > > On Fri, May 20 2022, Erick Ochoa via Gcc wrote: > > Hi

Questions on transition from IPA_PASS (LTRANS) to SIMPLE_IPA_PASS

2022-06-09 Thread Erick Ochoa via Gcc
Hi, I understand some differences between IPA_PASSes and SIMPLE_IPA_PASSes. However, I have questions about the cleanup processes that IPA_PASSes might have. * Would it be correct to assume that all node and edge summaries are deleted after the last IPA_PASS? And would it also be correct to assum

Question about speculative make_edge_direct_to_target during LTO/IPA_PASS

2022-07-01 Thread Erick Ochoa via Gcc
Hi, I have a pass that is able to speculate the target of indirect function calls. This pass is an IPA_PASS. It: 1. generates summaries with the possible targets. 2. writes analysis summary 3. reads analysis summary 4. combines the results from multiple partitions and if needed fixes the targets

Re: Question about speculative make_edge_direct_to_target during LTO/IPA_PASS

2022-07-07 Thread Erick Ochoa via Gcc
On Fri, 1 Jul 2022 at 14:48, Martin Jambor wrote: > Why so late, why not as part of number 4? > Hi Martin, Thanks for the feedback. The original reason why the call to make_edge_direct_to_target was done so late is because of the lack of function bodies during WPA, summaries with insufficient i

Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
Hello, I'm looking for some help in how to create a new function at compile time / link time. The idea is an alternative form of constant propagation. The current implementation of ipa-cp, may specialize functions for which arguments may be known at compile time. Call graph edges from the caller

Re: Question about speculative make_edge_direct_to_target during LTO/IPA_PASS

2022-07-14 Thread Erick Ochoa via Gcc
Hi Martin, thanks a lot for your help! You were right! I am now able to call make_edge_direct_to_target during WPA. -Erick

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
Hi Richard, > > > So instead of wrapping the function why not transform the original > function > > to have a prologue doing a runtime check for the compile-time specialized > > versions and perform tail-calls to them? > > > > What I'm missing is who would call mul_test_param in your case? > The

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
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 pe

Re: Creating a wrapper around a function at compile time

2022-07-14 Thread Erick Ochoa via Gcc
On Thu, 14 Jul 2022 at 16:10, Martin Liška wrote: > On 7/14/22 16:08, Erick Ochoa via Gcc wrote: > > Last time I checked, value profiling can only track a single value per > > statement. > > Hi. > > Take a look at HIST_TYPE_INDIR_CALL which we use for tracki

Re: Creating a wrapper around a function at compile time

2022-07-15 Thread Erick Ochoa via Gcc
Awesome! Thanks! Let's go a little bit into the transformation mechanics itself. I am somewhat familiar with LTO but I am always confused about the transformations scheduled during WPA. Let's assume that: 1. we have the profiling pass, which profiles each argument in each callsite. 2. we are now