Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: tools/pnacl-llc/pnacl-llc.cpp

Issue 1121433002: Always use a FunctionPassManager in pnacl-llc. MPPassManager breaks threading. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pnacl-llc/pnacl-llc.cpp
diff --git a/tools/pnacl-llc/pnacl-llc.cpp b/tools/pnacl-llc/pnacl-llc.cpp
index f18938aa742f4cacc41f427f52071895a4cf2688..cc0ee94bd0cad6a3d3fdbfdb36a1e731e9f5f32d 100644
--- a/tools/pnacl-llc/pnacl-llc.cpp
+++ b/tools/pnacl-llc/pnacl-llc.cpp
@@ -428,11 +428,9 @@ static int runCompilePasses(Module *ModuleRef,
}
// Build up all of the passes that we want to do to the module.
- std::unique_ptr<PassManagerBase> PM;
- if (LazyBitcode)
- PM.reset(new FunctionPassManager(ModuleRef));
- else
- PM.reset(new PassManager());
+ // We always use a FunctionPassManager to divide up the functions
+ // among threads (instead of a whole-module PassManager).
+ std::unique_ptr<FunctionPassManager> PM(new FunctionPassManager(ModuleRef));
// Add the target data from the target machine, if it exists, or the module.
if (const DataLayout *DL = Target.getSubtargetImpl()->getDataLayout())
@@ -475,59 +473,54 @@ static int runCompilePasses(Module *ModuleRef,
return 1;
}
- if (LazyBitcode) {
- auto FPM = static_cast<FunctionPassManager *>(PM.get());
- FPM->doInitialization();
- unsigned FuncIndex = 0;
- switch (SplitModuleSched) {
- case SplitModuleStatic:
- for (Function &F : *ModuleRef) {
- if (FuncQueue->GrabFunctionStatic(FuncIndex, ModuleIndex)) {
- FPM->run(F);
- CheckABIVerifyErrors(ABIErrorReporter, "Function " + F.getName());
- F.Dematerialize();
- }
- ++FuncIndex;
+ PM->doInitialization();
+ unsigned FuncIndex = 0;
+ switch (SplitModuleSched) {
+ case SplitModuleStatic:
+ for (Function &F : *ModuleRef) {
+ if (FuncQueue->GrabFunctionStatic(FuncIndex, ModuleIndex)) {
+ PM->run(F);
+ CheckABIVerifyErrors(ABIErrorReporter, "Function " + F.getName());
+ F.Dematerialize();
}
- break;
- case SplitModuleDynamic:
- unsigned ChunkSize = 0;
- unsigned NumFunctions = FuncQueue->Size();
- Module::iterator I = ModuleRef->begin();
- while (FuncIndex < NumFunctions) {
- ChunkSize = FuncQueue->RecommendedChunkSize();
- unsigned NextIndex;
- bool grabbed = FuncQueue->GrabFunctionDynamic(FuncIndex, ChunkSize,
- NextIndex);
- if (grabbed) {
- while (FuncIndex < NextIndex) {
- if (!I->isMaterializable() && I->isDeclaration()) {
- ++I;
- continue;
- }
- FPM->run(*I);
- CheckABIVerifyErrors(ABIErrorReporter, "Function " + I->getName());
- I->Dematerialize();
- ++FuncIndex;
+ ++FuncIndex;
+ }
+ break;
+ case SplitModuleDynamic:
+ unsigned ChunkSize = 0;
+ unsigned NumFunctions = FuncQueue->Size();
+ Module::iterator I = ModuleRef->begin();
+ while (FuncIndex < NumFunctions) {
+ ChunkSize = FuncQueue->RecommendedChunkSize();
+ unsigned NextIndex;
+ bool grabbed =
+ FuncQueue->GrabFunctionDynamic(FuncIndex, ChunkSize, NextIndex);
+ if (grabbed) {
+ while (FuncIndex < NextIndex) {
+ if (!I->isMaterializable() && I->isDeclaration()) {
++I;
+ continue;
}
- } else {
- while (FuncIndex < NextIndex) {
- if (!I->isMaterializable() && I->isDeclaration()) {
- ++I;
- continue;
- }
- ++FuncIndex;
+ PM->run(*I);
+ CheckABIVerifyErrors(ABIErrorReporter, "Function " + I->getName());
+ I->Dematerialize();
+ ++FuncIndex;
+ ++I;
+ }
+ } else {
+ while (FuncIndex < NextIndex) {
+ if (!I->isMaterializable() && I->isDeclaration()) {
++I;
+ continue;
}
+ ++FuncIndex;
+ ++I;
}
}
- break;
}
- FPM->doFinalization();
- } else
- static_cast<PassManager *>(PM.get())->run(*ModuleRef);
-
+ break;
+ }
+ PM->doFinalization();
return 0;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698