Skip to content

Commit

Permalink
Restrict COFF to a single thread when symbol count is high (#50874)
Browse files Browse the repository at this point in the history
  • Loading branch information
pchintalapudi authored Aug 11, 2023
1 parent 2c0e1d8 commit eb4416b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ static FunctionInfo getFunctionWeight(const Function &F)
}

struct ModuleInfo {
Triple triple;
size_t globals;
size_t funcs;
size_t bbs;
Expand All @@ -661,6 +662,7 @@ struct ModuleInfo {

ModuleInfo compute_module_info(Module &M) {
ModuleInfo info;
info.triple = Triple(M.getTargetTriple());
info.globals = 0;
info.funcs = 0;
info.bbs = 0;
Expand Down Expand Up @@ -1412,6 +1414,13 @@ static unsigned compute_image_thread_count(const ModuleInfo &info) {
LLVM_DEBUG(dbgs() << "32-bit systems are restricted to a single thread\n");
return 1;
#endif
// COFF has limits on external symbols (even hidden) up to 65536. We reserve the last few
// for any of our other symbols that we insert during compilation.
if (info.triple.isOSBinFormatCOFF() && info.globals > 64000) {
LLVM_DEBUG(dbgs() << "COFF is restricted to a single thread for large images\n");
return 1;
}

// This is not overridable because empty modules do occasionally appear, but they'll be very small and thus exit early to
// known easy behavior. Plus they really don't warrant multiple threads
if (info.weight < 1000) {
Expand Down

2 comments on commit eb4416b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.