[LLVMdev] struct type parament

Haopeng Liu hyliuhp at gmail.com
Tue Jun 2 13:31:58 PDT 2015


Hi Mehdi,

Thanks for your reply.

It seems caused by random rename because I saw 
%struct.StructTyName.692.475*, which might be twice renaming.

Does this collision occur because this type is declared more than once?

I encountered this problem when used clang to compile transmission 1.42 
(http://download.transmissionbt.com/files/) with configuration: 
"./configure --disable-gtk". Then in ./third-party/libevent/event.o.ll, 
you can see the function "event_base_get_method" is an example.

Best,
Haopeng

On 6/2/15 1:48 PM, Mehdi Amini wrote:
> Hi,
>
> I think this is when a collision is found on the name.
> I would be interesting to have the full test, it might be that the API is used in a way such that type is constantly re-created even if it already exists, which might be inefficient.
>
> See in lib/IR/Type.cpp, StructType::setName(StringRef Name):
>
> ...
>    // While we have a name collision, try a random rename.
>    if (Entry->getValue()) {
>      SmallString<64> TempStr(Name);
>      TempStr.push_back('.');
>      raw_svector_ostream TmpStream(TempStr);
>      unsigned NameSize = Name.size();
>     
>      do {
>        TempStr.resize(NameSize + 1);
>        TmpStream.resync();
>        TmpStream << getContext().pImpl->NamedStructTypesUniqueID++;
>        
>        Entry = &getContext().pImpl->
>                   NamedStructTypes.GetOrCreateValue(TmpStream.str());
>      } while (Entry->getValue());
>    }
>
>
>> Mehdi
>
>> On Jun 2, 2015, at 11:23 AM, Haopeng Liu <hyliuhp at gmail.com> wrote:
>>
>> Hi All,
>>
>> I generated the following code with "clang -flto" command.
>>
>> void test(struct StruTyName *a) {
>>     ...
>> }
>>
>> Then the type of test function is "void (%struct.StruTyName.100*)" by calling function::getFunctionType API.
>>
>> What's the meaning of number 100?
>>
>> Best,
>> Haopeng
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list