[llvm-dev] Verifier in loop pass manager

Mikhail Zolotukhin via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 8 17:59:48 PDT 2016


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?

Thanks,
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160408/641ab6fa/attachment.html>


More information about the llvm-dev mailing list