[PATCH] D60765: [ELF] Place SectionPiece::{Live,Hash} bit fields together

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 02:57:44 PDT 2019


MaskRay added a comment.

My `perf stat` results varied. I think the difference was noise. I cannot say if `uint32_t Live : 1; uint32_t Hash : 29; uint32_t OutputOffHi : 2; uint32_t OutputOffLo = 0;` and `uint32_t Live : 1; uint32_t Hash : 23; uint32_t OutputOffHi : 8; uint32_t OutputOffLo = 0;` make it faster or slower.

However, I just noticed that the split will be unsafe and that can't be fixed by reordering if conditions.

  if (!Sec->Pieces[I].Live) // unsafe to read in another thread
    continue;
  size_t ShardId = getShardId(Sec->Pieces[I].Hash); // unsafe to read in another thread
  if ((ShardId & (Concurrency - 1)) == ThreadId)
    Sec->Pieces[I].setOutputOff(Shards[ShardId].add(Sec->getData(I))); // OutputOffHi is being written


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60765/new/

https://reviews.llvm.org/D60765





More information about the llvm-commits mailing list