Skip to content

Commit

Permalink
[PM] Fix r307532: Get rid of a dangling reference.
Browse files Browse the repository at this point in the history
Escaping lambda by-reference capture of local variable caused a dangling
reference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307534 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pfaffe committed Jul 10, 2017
1 parent 58d2b3a commit 45074ea
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions tools/opt/NewPMDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,41 +88,43 @@ static cl::opt<std::string> VectorizerStartEPPipeline(
static void registerEPCallbacks(PassBuilder &PB, bool VerifyEachPass,
bool DebugLogging) {
if (!PeepholeEPPipeline.empty())
PB.registerPeepholeEPCallback(
[&](FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, PeepholeEPPipeline, VerifyEachPass,
DebugPM);
});
PB.registerPeepholeEPCallback([&PB, VerifyEachPass, DebugLogging](
FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, PeepholeEPPipeline, VerifyEachPass,
DebugPM);
});
if (!LateLoopOptimizationsEPPipeline.empty())
PB.registerLateLoopOptimizationsEPCallback(
[&](LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
[&PB, VerifyEachPass, DebugLogging](
LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, LateLoopOptimizationsEPPipeline,
VerifyEachPass, DebugPM);
});
if (!LoopOptimizerEndEPPipeline.empty())
PB.registerLoopOptimizerEndEPCallback(
[&](LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline,
VerifyEachPass, DebugPM);
});
PB.registerLoopOptimizerEndEPCallback([&PB, VerifyEachPass, DebugLogging](
LoopPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline,
VerifyEachPass, DebugPM);
});
if (!ScalarOptimizerLateEPPipeline.empty())
PB.registerScalarOptimizerLateEPCallback(
[&](FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
[&PB, VerifyEachPass, DebugLogging](
FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, ScalarOptimizerLateEPPipeline,
VerifyEachPass, DebugPM);
});
if (!CGSCCOptimizerLateEPPipeline.empty())
PB.registerCGSCCOptimizerLateEPCallback(
[&](CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline,
VerifyEachPass, DebugPM);
});
PB.registerCGSCCOptimizerLateEPCallback([&PB, VerifyEachPass, DebugLogging](
CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline,
VerifyEachPass, DebugPM);
});
if (!VectorizerStartEPPipeline.empty())
PB.registerVectorizerStartEPCallback(
[&](FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, VectorizerStartEPPipeline,
VerifyEachPass, DebugPM);
});
PB.registerVectorizerStartEPCallback([&PB, VerifyEachPass, DebugLogging](
FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) {
return PB.parsePassPipeline(PM, VectorizerStartEPPipeline, VerifyEachPass,
DebugPM);
});
}

bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
Expand Down

0 comments on commit 45074ea

Please sign in to comment.