[llvm-dev] Verifier in loop pass manager

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 8 18:08:40 PDT 2016


Mikhail Zolotukhin <mzolotukhin at apple.com> writes:
> Hi,
>
> When I recently was working on PR27157, I discovered a weird behavior
> in our verifier, which made it impossible to discover the bug by using
> '-verify-dom-info - verify' flags. This happens because, when we fully
> unroll a loop, we remove it from the LPM loop queue along with all
> analyses related to it. Here is the code responsible for it:
>
>       {
>         PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
>         TimeRegion PassTimer(getPassTimer(P));
>
>         Changed |= P->runOnLoop(CurrentLoop, *this);
>       }
>       LoopWasDeleted = CurrentLoop->isInvalid();
>
>       if (Changed)
>         dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG,
>                      LoopWasDeleted ? "<deleted>"
>                                     : CurrentLoop->getHeader()->getName());
>       dumpPreservedSet(P);
>
>       if (LoopWasDeleted) {
>         // Notify passes that the loop is being deleted.
>         deleteSimpleAnalysisLoop(CurrentLoop);
>       } else {
>         // Manually check that this loop is still healthy. This is done
>         // instead of relying on LoopInfo::verifyLoop since LoopInfo
>         // is a function pass and it's really expensive to verify every
>         // loop in the function every time. That level of checking can be
>         // enabled with the -verify-loop-info option.
>         {
>           TimeRegion PassTimer(getPassTimer(&LIWP));
>           CurrentLoop->verifyLoop();
>         }
>
>         // Then call the regular verifyAnalysis functions.
>         verifyPreservedAnalysis(P);
>
>         F.getContext().yield();
>       }
>
> Was it intentional that verifyPreservedAnalysis is under
> !LoopWasDeleted condition? Will anything break if we move
> verifyPreservedAnalysis out of the if?

Seems like a mistake to me. Try it?

> Thanks,
> Michael


More information about the llvm-dev mailing list