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

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-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
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: 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

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-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

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

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

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

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 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 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

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 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

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 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

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

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

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

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_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_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

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

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 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

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 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

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

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

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

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

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,

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
> > 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
> > 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-21 Thread Erick Ochoa via Gcc
ool_node->name () 4. the pointer address being pointed by varpool node I think we had a previous discussion where it was mentioned that the only way to distinguish between these cases is to look at varpool_node cgraph_node: (From a different email edited for brevity) On Wed, 30 Jun 2021 a

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

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 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

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-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 Mon, 12 Jul 2021 at 12:55, Erick Ochoa wrote: > > > 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

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-09 Thread Erick Ochoa via Gcc
appreciated. Thanks! On Wed, 7 Jul 2021 at 11:27, Erick Ochoa wrote: > > 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 v

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

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.

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

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

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

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,

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

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!

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: 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

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:

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

Re: Question about reading LTO function summaries

2021-04-06 Thread Erick Ochoa via Gcc
ing I can do to help. >From 8e0e2c7d821baab8ac6dbdd6fad590e8332b Mon Sep 17 00:00:00 2001 From: Erick Ochoa Date: Tue, 6 Apr 2021 16:34:48 +0200 Subject: [PATCH] Simple hello world for IPA_PASS --- gcc/Makefile.in | 1 + gcc/common.opt| 4 ++ gcc/ipa-hello-world

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 >

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 about reading LTO function summaries

2021-04-01 Thread Erick Ochoa via Gcc
advance! On Tue, 30 Mar 2021 at 10:18, Erick Ochoa wrote: > > 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 a

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:

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 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 mad

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: More questions on points-to analysis

2021-03-19 Thread Erick Ochoa via Gcc
we see ESCAPED = { NULL } Here is the full points-to sets: computed for foo: ``` ANYTHING = { ANYTHING } ESCAPED = { NULL } NONLOCAL = { ESCAPED NONLOCAL } STOREDANYTHING = { } INTEGER = { ANYTHING } ISRA.4 = { NONLOCAL } derefaddrtmp(9) = { NULL } foo.constprop.0.isra.0 = { } ``` I think this might have t

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 > >

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. Tha

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: > >

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

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

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

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,

Re: Dead Field Elimination and Field Reordering

2020-11-11 Thread Erick Ochoa
issue. After this, I will be removing std data structures and using specific ones. If anyone have any comments about the transformation, please let me know. I am happy to answer questions. -Erick On 06.11.20 05:51, Erick Ochoa wrote: Hi Richard, just some top-level comments before I write about

Re: Dead Field Elimination and Field Reordering

2020-11-06 Thread Erick Ochoa
the visitors. On 05/11/2020 14:10, Richard Biener wrote: On Tue, Nov 3, 2020 at 5:21 PM Erick Ochoa wrote: Thanks for the review Richard I'll address what I can. I also provide maybe some hindsight into some of the design decisions here. I'm not trying to be defensive just hoping to

Re: Dead Field Elimination and Field Reordering

2020-11-03 Thread Erick Ochoa
why these designs were made. On 03/11/2020 15:58, Richard Biener wrote: On Fri, Oct 30, 2020 at 6:44 PM Erick Ochoa wrote: Hello again, I've been working on several implementations of data layout optimizations for GCC, and I am again kindly requesting for a review of the type escape b

Dead Field Elimination and Field Reordering

2020-10-30 Thread Erick Ochoa
Hello again, I've been working on several implementations of data layout optimizations for GCC, and I am again kindly requesting for a review of the type escape based dead field elimination and field reorg. Thanks to everyone that has helped me. The main differences between the previous comm

Re: Question about callgraph and call_stmt

2020-10-13 Thread Erick Ochoa
On 13/10/2020 13:37, Richard Biener wrote: On Tue, Oct 13, 2020 at 1:17 PM Erick Ochoa wrote: Hi, I am analyzing gimple calls during LTO. What's symtab->state at this point? The state is IPA_SSA_AFTER_INLINING. I found a gimple call statement s that has the following pr

Question about callgraph and call_stmt

2020-10-13 Thread Erick Ochoa
Hi, I am analyzing gimple calls during LTO. I found a gimple call statement s that has the following properties: ``` tree fndecl = gimple_call_fndecl(s) gcc_assert(fndecl) // That is, the gimple call returns a non-null fndecl. cgraph_node *n = cgraph_node::get(fndecl); gcc_assert(!n) // That i

Re: On IPA PTA field sensitivity and pointer expression (part 2)

2020-09-29 Thread Erick Ochoa
} same as p1.128+64 temp2_34 = { c } Thanks! On 28/09/2020 14:30, Erick Ochoa wrote: On 28/09/2020 14:25, Erick Ochoa wrote: Hi, previously I sent an e-mail inquiring about the state of points-to information of structure variables allocated in the heap. It was brought to my attention that

Re: On IPA PTA field sensitivity and pointer expression (part 2)

2020-09-28 Thread Erick Ochoa
On 28/09/2020 14:25, Erick Ochoa wrote: Hi, previously I sent an e-mail inquiring about the state of points-to information of structure variables allocated in the heap. It was brought to my attention that heap variables do not have a size to model and therefore IPA-PTA is not able to

On IPA PTA field sensitivity and pointer expression (part 2)

2020-09-28 Thread Erick Ochoa
Hi, previously I sent an e-mail inquiring about the state of points-to information of structure variables allocated in the heap. It was brought to my attention that heap variables do not have a size to model and therefore IPA-PTA is not able to provide field sensitivity. I now understand bet

Re: On IPA-PTA field sensitivity and pointer expressions

2020-09-25 Thread Erick Ochoa
On 25/09/2020 13:30, Richard Biener wrote: On Fri, Sep 25, 2020 at 9:05 AM Erick Ochoa wrote: Hi, I am working on an alias analysis using the points-to information generated during IPA-PTA. If we look at the varmap varinfo_t array in gcc/tree-ssa-struct.c, most of the constraint variable

On IPA-PTA field sensitivity and pointer expressions

2020-09-25 Thread Erick Ochoa
Hi, I am working on an alias analysis using the points-to information generated during IPA-PTA. If we look at the varmap varinfo_t array in gcc/tree-ssa-struct.c, most of the constraint variable info structs contain a non-null decl field which points to a valid tree in gimple (which is an SSA

Re: Question about instrumenting gimple

2020-09-16 Thread Erick Ochoa
Thanks Richard, for sake of completeness (and anyone in the future looks for a simple hello world example), here's what my code roughly looks like: push_cfun(f); // f is the function who calls malloc static void call_hello_world(gimple* g) { gimple_stmt_iterator gsi = gsi_start(g); const

Question about instrumenting gimple

2020-09-15 Thread Erick Ochoa
Hi, I am trying to instrument gimple so that "hello world" is printed after each call to malloc. I've tried instrumenting using the following code static void // G points to the gcall which corresponds to malloc call_hello_world(gimple* g) { gimple_stmt_iterator gsi = gsi_start(g); // cre

Re: Dominance information problem

2020-09-14 Thread Erick Ochoa
Hi Gary, I'm not 100% sure this will fix the problem, but in the past I have had to call the following function: /* If dominator info is not available, we need to calculate it. */ if (!dom_info_available_p (CDI_DOMINATORS)) calculate_dominance_info (CDI_DOMINATORS); Basically dominan

Re: Is there a way to look for a tree by its UID?

2020-09-04 Thread Erick Ochoa
On 04/09/2020 15:19, Richard Biener wrote: On Fri, Sep 4, 2020 at 10:13 AM Erick Ochoa wrote: On 03/09/2020 12:19, Richard Biener wrote: On Thu, Sep 3, 2020 at 10:58 AM Jakub Jelinek via Gcc wrote: On Thu, Sep 03, 2020 at 10:22:52AM +0200, Erick Ochoa wrote: So, I am just wondering

Re: Is there a way to look for a tree by its UID?

2020-09-04 Thread Erick Ochoa
On 03/09/2020 12:19, Richard Biener wrote: On Thu, Sep 3, 2020 at 10:58 AM Jakub Jelinek via Gcc wrote: On Thu, Sep 03, 2020 at 10:22:52AM +0200, Erick Ochoa wrote: So, I am just wondering is there an interface where I could do something like: ``` // vars is the field in pt_solution

Is there a way to look for a tree by its UID?

2020-09-03 Thread Erick Ochoa
I think every SSA_NAME variable has a: * ptr_info_def* * which points to a pt_solution * which points to a bitmap field vars and I think this bitmap vars is set with 1 in the UID location of variables/references that an SSA_NAME variable might point to it. So, I am just wondering is there an

Question about exporting omputing alias sets

2020-09-02 Thread Erick Ochoa
Hello, I am trying to find out all pointers which alias a pointer and place them in a set. I am using `ptr_derefs_may_alias_p` to find out if two pointers may point to the same memory location. I think this yields conservative results (i.e., when it cannot be proven that to pointers may alia

Test case for improving PTA precision

2020-08-28 Thread Erick Ochoa
Hi, I'm testing the precision of IPA-PTA when compiling with -flto. I found this case when a global variable is marked as escaping even if the variable is a primitive type and no address is taken. This is the result of IPA-PTA which I believe is wrong. buff2 = { ESCAPED NONLOCAL } buff1 = {

Re: Do all global structure variables escape in IPA-PTA?

2020-08-26 Thread Erick Ochoa
On 26/08/2020 10:36, Erick Ochoa wrote: On 25/08/2020 22:03, Richard Biener wrote: On August 25, 2020 6:36:19 PM GMT+02:00, Erick Ochoa wrote: On 25/08/2020 17:19, Erick Ochoa wrote: On 25/08/2020 17:10, Richard Biener wrote: On August 25, 2020 3:09:13 PM GMT+02:00, Erick Ochoa

Re: Do all global structure variables escape in IPA-PTA?

2020-08-26 Thread Erick Ochoa
On 25/08/2020 22:03, Richard Biener wrote: On August 25, 2020 6:36:19 PM GMT+02:00, Erick Ochoa wrote: On 25/08/2020 17:19, Erick Ochoa wrote: On 25/08/2020 17:10, Richard Biener wrote: On August 25, 2020 3:09:13 PM GMT+02:00, Erick Ochoa wrote: Hi, I'm trying to understan

Re: Do all global structure variables escape in IPA-PTA?

2020-08-25 Thread Erick Ochoa
On 25/08/2020 17:19, Erick Ochoa wrote: On 25/08/2020 17:10, Richard Biener wrote: On August 25, 2020 3:09:13 PM GMT+02:00, Erick Ochoa wrote: Hi, I'm trying to understand how the escape analysis in IPA-PTA works. I was testing a hypothesis where if a structure contains an arr

Re: Do all global structure variables escape in IPA-PTA?

2020-08-25 Thread Erick Ochoa
On 25/08/2020 17:10, Richard Biener wrote: On August 25, 2020 3:09:13 PM GMT+02:00, Erick Ochoa wrote: Hi, I'm trying to understand how the escape analysis in IPA-PTA works. I was testing a hypothesis where if a structure contains an array of characters and this array of characte

Do all global structure variables escape in IPA-PTA?

2020-08-25 Thread Erick Ochoa
Hi, I'm trying to understand how the escape analysis in IPA-PTA works. I was testing a hypothesis where if a structure contains an array of characters and this array of characters is passed to fopen, the structure and all subfields will escape. To do this, I made a program that has a global

Re: Question about IPA-PTA and build_alias

2020-08-24 Thread Erick Ochoa
On 24/08/2020 09:40, Richard Biener wrote: On Mon, Aug 17, 2020 at 3:22 PM Erick Ochoa wrote: Hello, I'm looking to understand better the points-to analysis (IPA-PTA) and the alias analysis (build_alias). How is the information produced by IPA-PTA consumed? Are alias sets in build_

Re: [RFC] LTO Dead Field Elimination and LTO Field Reordering

2020-08-20 Thread Erick Ochoa
chinery and tests. If there is anything we can do to make this easier for you to review do let us know. Thanks, Tamar -Original Message- From: Erick Ochoa Sent: Monday, August 17, 2020 2:53 PM To: GCC Development Cc: Christoph Müllner ; philipp.toms...@theobroma-systems.com; Tamar Chri

Question about Gimple Variables named D.[0-9]*

2020-08-20 Thread Erick Ochoa
Hello, I am looking at the dump for the build_alias pass. I see a lot of variables with the naming convention D.[0-9]* in the points-to sets being printed. When I compile with -fdump-tree-all-all I can see that the suffix D.[0-9]* is appended to some gimple variables. I initially imagined

  1   2   >