[PATCH] D42528: [LTO] - Introduce GlobalResolution::Prevailing flag.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 07:20:16 PST 2018


>> Index: lib/LTO/LTO.cpp
>> ===================================================================
>> --- lib/LTO/LTO.cpp
>> +++ lib/LTO/LTO.cpp
>> @@ -419,11 +419,14 @@
>>      auto &GlobalRes = GlobalResolutions[Sym.getName()];
>>      GlobalRes.UnnamedAddr &= Sym.isUnnamedAddr();
>>      if (Res.Prevailing) {
>> -      assert(GlobalRes.IRName.empty() &&
>> +      assert(!GlobalRes.Prevailing &&
>>               "Multiple prevailing defs are not allowed");
>> -      GlobalRes.IRName = Sym.getIRName();
>> +      GlobalRes.Prevailing = true;
>>      }
>>
>> +    if (GlobalRes.IRName.empty())
>> +      GlobalRes.IRName = Sym.getIRName();
>
>Why do you need the second if? It is still true that only for prevailing
>symbols we need the name, no?

No. Previously GlobalRes.IRName was set only for prevailing symbols.
And so "if (GlobalRes.IRName)" was used like "if (Prevailing)".

But now I need IRName for both privailing and not-prevailing symbols
(see change in Error LTO::run(AddStreamFn AddStream, NativeObjectCache Cache) ).
So I had to add bool Prevailing flag.

With that I can mark Live all PrevailingType::Yes and PrevailingType::Unknown
and make PrevailingType::No dead.

>That is, could this be:
>
>  if (Res.Prevailing) {
 >     assert(!GlobalRes.Prevailing &&
 >            "Multiple prevailing defs are not allowed");
 >     GlobalRes.IRName = Sym.getIRName();
 >     GlobalRes.Prevailing = true;
 >     GlobalRes.IRName = Sym.getIRName();
>  }
>
>Cheers,
>Rafael

George.


More information about the llvm-commits mailing list