[IR] type disappeared

C code

UlschRsvdRbStru *rsvdArray = &(puschResult->rsvdRbArray[loop]);

IR code

%rsvdArray = alloca %struct.anon.0*, align 8

I am confused why the type of rsvdArray is %struct.anon.0? I can’t achieve the origin type of rsvdArray

by the way: the IR is a combine ll file from many other ll files

That’s probably why. IRLinker break those stuff

Are you sure it’s caused by the IRLinker? I feel this is unacceptable. I have lost the struct type information and cannot proceed with the following work. Did LLVM not consider this issue?

feel free to contribute a better linking solution that handles all the hiccups of type merging

1 Like

Are you sure it’s caused by the IRLinker? I feel this is unacceptable. I have lost the struct type information and cannot proceed with the following work. Did LLVM not consider this issue?

The names of struct types carry no semantic meaning whatsoever.

Furthermore, in your original post:

%rsvdArray = alloca %struct.anon.0*, align 8

This indicates that you are using an older version of LLVM. In more recent versions, the equivalent instruction will be %rsvdArray = alloca ptr, align 8, as the transition to opaque pointers has been completed.

I would recommend you think about how to change your algorithms to not rely on this information. I can’t make any specific recommendations, however, without further information.

2 Likes

LLVM will remove duplicate types, and pick one to use in the module. In other words, if you have two separate types whose definitions are identical, LLVM will pick one and drop the other one.