Skip to content

Commit

Permalink
[NFC][CodeGen] Remove redundant if clause in TargetPassConfig::addPass
Browse files Browse the repository at this point in the history
  • Loading branch information
KanRobert committed Mar 16, 2022
1 parent f473d4a commit ac64d0d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions llvm/lib/CodeGen/TargetPassConfig.cpp
Expand Up @@ -735,21 +735,21 @@ void TargetPassConfig::addPass(Pass *P) {
if (StopBefore == PassID && StopBeforeCount++ == StopBeforeInstanceNum)
Stopped = true;
if (Started && !Stopped) {
if (AddingMachinePasses)
if (AddingMachinePasses) {
// Construct banner message before PM->add() as that may delete the pass.
std::string Banner =
std::string("After ") + std::string(P->getPassName());
addMachinePrePasses();
std::string Banner;
// Construct banner message before PM->add() as that may delete the pass.
if (AddingMachinePasses)
Banner = std::string("After ") + std::string(P->getPassName());
PM->add(P);
if (AddingMachinePasses)
PM->add(P);
addMachinePostPasses(Banner);
} else {
PM->add(P);
}

// Add the passes after the pass P if there is any.
for (const auto &IP : Impl->InsertedPasses) {
for (const auto &IP : Impl->InsertedPasses)
if (IP.TargetPassID == PassID)
addPass(IP.getInsertedPass());
}
} else {
delete P;
}
Expand Down

0 comments on commit ac64d0d

Please sign in to comment.