How to write/read tree contains ssa_name in lto
Richard Biener
richard.guenther@gmail.com
Tue Oct 14 12:31:04 GMT 2025
On Tue, Oct 14, 2025 at 2:22 PM ywgrit <yw987194828@gmail.com> wrote:
>
> A program may consist of multiple compilation units, and multiple array access operations may exist within the program.
> In SIMPLE_IPA_PASS, I want to check whether the index is consistent during two array accesses: During the first pass through all functions, traverse all gimples, record each array access operation, and store its corresponding {Function *, index} into a hash_set. During the second pass through all functions, when encountering the array access operation we wish to process, search for {Function *, index} in the hash_set.
> Converting SIMPLE_IPA_PASS to IPA_PASS presents challenges.
> Since Function * is a pointer, direct transfer is meaningless. index is an ssa_name, so direct transfer is also impossible. My question is: Since the above approach fails, if I encounter an array access operation during the wpa phase, how should I determine whether there exists another array access operation within the same function that shares the same index?
You have to split the pass into local analysis pre-WPA which would
need to compute this (while it has access
to the body of the function) a "merge" operation during WPA and a
transform during LTRANS. Note
that comparing SSA names itself between functions is meaningless, I'm
guessing you want to
compute the array access index based on function parameters?
Richard,
> Thanks.
>
> ywgrit.
>
> Richard Biener <richard.guenther@gmail.com> 于2025年10月13日周一 14:42写道:
>>
>> On Sat, Oct 11, 2025 at 10:32 AM ywgrit via Gcc <gcc@gcc.gnu.org> wrote:
>> >
>> > I used the functions stream_write_tree/stream_read_tree in lto. If tree
>> > contains ssa_name, then stream_read_tree will generate ice: cfun is null in
>> > wpa, so (*SSANAMES (cfun))[ix] will break the program. How to write/read
>> > tree contains ssa_name in lto, e.g., wpa phase?
>>
>> You shouldn't - you have to abstract from this somehow as during WPA phase
>> a SSA name doesn't make "sense". That said, you have to elaborate a bit on
>> what you are trying to do.
>>
>> Richard.
>>
>> > Thanks.
>> >
>> > ywgrit.
More information about the Gcc
mailing list