diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index 520018005f1..b123d54eeea 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -475,10 +475,11 @@ int main(int argc, char **argv) { errs() << argv[0] << ": cannot create pass: " << PassInf->getPassName() << "\n"; if (P) { + PassKind Kind = P->getPassKind(); addPass(Passes, P); if (AnalyzeOnly) { - switch (P->getPassKind()) { + switch (Kind) { case PT_BasicBlock: Passes.add(new BasicBlockPassPrinter(PassInf)); break;