[PATCH] D29170: [ELF] - Remove unnessesary checks from GC logic.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 00:47:35 PST 2017


>George Rimar via Phabricator <reviews at reviews.llvm.org> writes:
>>    // Mark the piece at a given offset live. Used by GC.
>> +  // We always keep whole non-alloc sections (usually debug ones).
>>    void markLiveAt(uintX_t Offset) {
>> -    assert(this->Flags & llvm::ELF::SHF_ALLOC);
>> -    LiveOffsets.insert(Offset);
>> +    if (this->Flags & SHF_ALLOC)
>> +      LiveOffsets.insert(Offset);
>>    }
>
>When is markLiveAt called in an non alloc section now? If the section
>Live bit was already set, this should not have been called, no?
>
>Cheers,
>Rafael

It is still called from Enqueue. Live bit checked a bit later, I did not change anything here:

  auto Enqueue = [&](ResolvedReloc<ELFT> R) {
....
    // Usually, a whole section is marked as live or dead, but in mergeable
    // (splittable) sections, each piece of data has independent liveness bit.
    // So we explicitly tell it which offset is in use.
    if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(R.Sec))
      MS->markLiveAt(R.Offset);

    if (R.Sec->Live)
      return;
    R.Sec->Live = true;
 ...
  };

George.


More information about the llvm-commits mailing list