[llvm-commits] [llvm] r160446 - /llvm/trunk/lib/VMCore/PassManager.cpp

Nick Lewycky nlewycky at google.com
Wed Jul 18 13:12:58 PDT 2012


On 18 July 2012 12:59, Victor Oliveira <Victor.Oliveira at amd.com> wrote:

> Author: victorm
> Date: Wed Jul 18 14:59:29 2012
> New Revision: 160446
>
> URL: http://llvm.org/viewvc/llvm-project?rev=160446&view=rev
> Log:
> Adding some debug information to PassManager
>
>
> Modified:
>     llvm/trunk/lib/VMCore/PassManager.cpp
>
> Modified: llvm/trunk/lib/VMCore/PassManager.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=160446&r1=160445&r2=160446&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/VMCore/PassManager.cpp (original)
> +++ llvm/trunk/lib/VMCore/PassManager.cpp Wed Jul 18 14:59:29 2012
> @@ -593,6 +593,26 @@
>        Pass *AnalysisPass = findAnalysisPass(*I);
>        if (!AnalysisPass) {
>          const PassInfo *PI =
> PassRegistry::getPassRegistry()->getPassInfo(*I);
> +
> +        if (PI == NULL) {
> +          // Pass P is not in the global PassRegistry
> +          dbgs() << "Pass '"  << P->getPassName() << "' is not
> initialized." << "\n";
> +          dbgs() << "Verify if there is a pass dependency cycle." << "\n";
>

This will print "Pass foo is not initialized." but it doesn't give me any
reason why it should be?

The text "Verify if ..." is awkward. I'm not sure you need to print it at
all?


> +          dbgs() << "Required Passes:" << "\n";
> +          for (AnalysisUsage::VectorType::const_iterator I2 =
> RequiredSet.begin(),
> +                 E = RequiredSet.end(); I2 != E && I2 != I; ++I2) {
> +            Pass *AnalysisPass2 = findAnalysisPass(*I2);
> +            if (AnalysisPass2) {
> +              dbgs() << "\t" << AnalysisPass2->getPassName() << "\n";
> +            }
> +            else {
>

"}" and "else" on same line.


> +              dbgs() << "\t"   << "Error: Required pass not found!
> Possible causes:"  << "\n";
> +              dbgs() << "\t\t" << "- Pass misconfiguration (e.g.: missing
> macros)"    << "\n";
> +              dbgs() << "\t\t" << "- Corruption of the global
> PassRegistry"           << "\n";
>

Including possible causes is unusual.


> +            }
> +          }
> +        }
> +
>

This whole block does nothing visible but call dbgs(), right? Wrap the
whole thing in DEBUG( ...code... ); That way it doesn't get into release
builds at all.

         assert(PI && "Expected required passes to be initialized");
>

Ultimately this patch exists to supplement this assert? If you're going to
take the time to diagnose why the pass wasn't found, I'd rather you
actually find what the cycle is and tell the user (if applicable), or find
out how the pass is misconfigured and explain that.

Nick


>          AnalysisPass = PI->createPass();
>          if (P->getPotentialPassManagerType () ==
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120718/72fb2bd4/attachment.html>


More information about the llvm-commits mailing list