Check frontier equivs for the free list
Ensures equivalences are not added to the frontier search if they are already in the free list.
This commit adds a check to ensure that when initial equivalences are added to the frontier search, none of them are already present in the free list. This corrects an oversight in the dom_oracle::start_search function within value-relation.cc, preventing potential issues with redundant or invalid equivalences. A new test case (pr127781.c) has been added to verify this fix.
In Details
This change affects the Dominance Oracle implementation in GCC's value-relation.cc, specifically within the dom_oracle::start_search method. The Dominance Oracle is used in optimizations to determine relationships between values. When initializing the search with a set of equivalences, it's crucial that these equivalences are valid and haven't been freed. The valid_equivs check already exists, but this commit adds a direct check to ensure that elements being considered for the 'frontier' (the set of equivalences to be processed) are not currently in the FREE_LIST (a list of invalidate…
- Dominance Oracle
- A component within GCC that helps determine control-flow and data-flow dominance relationships, crucial for various optimizations that depend on code execution order and data liveness.
- Equivalence
- In the context of value analysis, an equivalence indicates that two expressions or values are known to be equal at a certain point in the program.
- Frontier
- In algorithms related to data flow analysis or graph traversal, the frontier typically refers to the set of nodes or edges that are adjacent to the currently processed set, representing the next items to be explored.
- Free list
- A list containing elements that are no longer valid or are marked for deallocation. Operating on elements from the free list can lead to undefined behavior or crashes.
- RTL
- Register Transfer Language, an intermediate representation used within GCC to represent code before it is translated into machine code. It describes data transfers between registers and memory.