tree-ssa-structalias.cc: Why do we iterate over fields of a global varinfo
Question about redundant loops in IPA PTA code for shadow variables.
Filip Kastl is seeking clarification on a specific loop within GCC’s IPA PTA code, related to shadow variables. He questions the necessity of iterating over fields of a global varinfo, suspecting it might be redundant if those fields are already marked as global. This investigation aims to optimize or clarify the handling of aggregate variables and their fields in pointer analysis.
- proposer
Asks why a second loop over `vi_next()` is needed in `ipa_pta_execute()` for processing fields of global aggregate variables, questioning if fields are not already marked `is_global_var=true`.
- reviewer
Provided context by asking a question on Sep 1.
“On Tue, 1 Sep 2026, Filip Kastl wrote: > Hi. > > (by aggregates, I will mean C structs and arrays and similar constructs that > aggregate data from other languages that GCC compiles) > > The first question: > ------------------- > > I'm trying to understand the IPA PTA code related to shadow vars. In the code > snippet from tree-ssa-structalias.cc:ipa_pta_execute() below, why do we need > th…”
Technical Tradeoffs
- Potential for code simplification by removing redundant loops.
- Ensuring correctness of pointer analysis for aggregate types.
In Details
This discussion touches on GCC's Intermediate Representation (IR) and Pointer Analysis (PTA) within the Interprocedural Analysis (IPA) framework. Specifically, it questions the logic in tree-ssa-structalias.cc regarding varinfo_t processing for shadow variables, which represent local variables in a callee that might be aliased by parameters. The core issue is whether the current traversal correctly identifies and processes fields of global aggregates, potentially avoiding redundant work.