<div class="gmail_quote">On 18 July 2012 12:59, Victor Oliveira <span dir="ltr"><<a href="mailto:Victor.Oliveira@amd.com" target="_blank">Victor.Oliveira@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Author: victorm<br>
Date: Wed Jul 18 14:59:29 2012<br>
New Revision: 160446<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=160446&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=160446&view=rev</a><br>
Log:<br>
Adding some debug information to PassManager<br>
<br>
<br>
Modified:<br>
    llvm/trunk/lib/VMCore/PassManager.cpp<br>
<br>
Modified: llvm/trunk/lib/VMCore/PassManager.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=160446&r1=160445&r2=160446&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=160446&r1=160445&r2=160446&view=diff</a><br>


==============================================================================<br>
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)<br>
+++ llvm/trunk/lib/VMCore/PassManager.cpp Wed Jul 18 14:59:29 2012<br>
@@ -593,6 +593,26 @@<br>
       Pass *AnalysisPass = findAnalysisPass(*I);<br>
       if (!AnalysisPass) {<br>
         const PassInfo *PI = PassRegistry::getPassRegistry()->getPassInfo(*I);<br>
+<br>
+        if (PI == NULL) {<br>
+          // Pass P is not in the global PassRegistry<br>
+          dbgs() << "Pass '"  << P->getPassName() << "' is not initialized." << "\n";<br>
+          dbgs() << "Verify if there is a pass dependency cycle." << "\n";<br></blockquote><div><br></div><div>This will print "Pass foo is not initialized." but it doesn't give me any reason why it should be?</div>

<div><br></div><div>The text "Verify if ..." is awkward. I'm not sure you need to print it at all?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


+          dbgs() << "Required Passes:" << "\n";<br>
+          for (AnalysisUsage::VectorType::const_iterator I2 = RequiredSet.begin(),<br>
+                 E = RequiredSet.end(); I2 != E && I2 != I; ++I2) {<br>
+            Pass *AnalysisPass2 = findAnalysisPass(*I2);<br>
+            if (AnalysisPass2) {<br>
+              dbgs() << "\t" << AnalysisPass2->getPassName() << "\n";<br>
+            }<br>
+            else {<br></blockquote><div><br></div><div>"}" and "else" on same line.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


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

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+            }<br>
+          }<br>
+        }<br>
+<br></blockquote><div><br></div><div>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.</div><div><br></div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">         assert(PI && "Expected required passes to be initialized");<br></blockquote><div><br></div>
<div>
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.</div>

<div><br></div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
         AnalysisPass = PI->createPass();<br>
         if (P->getPotentialPassManagerType () ==<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br>