Improve parallelism of ICF.
authorRui Ueyama <ruiu@google.com>
Wed, 24 May 2017 19:22:34 +0000 (19:22 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 24 May 2017 19:22:34 +0000 (19:22 +0000)
commitf04c04837c88068345f5141ebe6720ce3ae3d559
tree6d605b03435b00558e020a3437d25a68bf0987ac
parent46fe6d47cca5cb7fd47186902612be0984c9a4c3
Improve parallelism of ICF.

This is the only place we use threads for ICF. The intention of this code
was to split an input vector into 256 shards and process them in parallel.
What the code was actually doing was to split an input into 257 shards,
process the first 256 shards in parallel, and the remaining one in serial.

That means this code takes ceil(256/n)+1 instead of ceil(256/n) where n
is the number of available CPU cores. The former converges to 2 while
the latter converges to 1.

This patches fixes the above issue.

llvm-svn: 303797
lld/COFF/ICF.cpp
lld/ELF/ICF.cpp