diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPassManager.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopPassManager.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp index fadd070..c98b94b 100644 --- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp @@ -269,10 +269,11 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F, PI.pushBeforeNonSkippedPassCallback([&LAR, &LI](StringRef PassID, Any IR) { if (isSpecialPass(PassID, {"PassManager"})) return; - assert(any_isa<const Loop *>(IR) || any_isa<const LoopNest *>(IR)); - const Loop *L = any_isa<const Loop *>(IR) - ? any_cast<const Loop *>(IR) - : &any_cast<const LoopNest *>(IR)->getOutermostLoop(); + assert(any_cast<const Loop *>(&IR) || any_cast<const LoopNest *>(&IR)); + const Loop **LPtr = any_cast<const Loop *>(&IR); + const Loop *L = LPtr ? *LPtr : nullptr; + if (!L) + L = &any_cast<const LoopNest *>(IR)->getOutermostLoop(); assert(L && "Loop should be valid for printing"); // Verify the loop structure and LCSSA form before visiting the loop. |