<div dir="ltr">Is this still relevant? If so, I'll put it in my queue.<br></div><br><div class="gmail_quote">On Mon, May 4, 2015 at 11:54 AM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi chandlerc,<br>
<br>
Some MachineFunction passes are not properly registered using INITIALIZE_PASS,<br>
but this doesn't normally seem to matter. One way in which it does matter is<br>
that the -print-{after,before}-all flags have no effect when running those<br>
passes. This change modifies the code that implements these flags so that<br>
they print even if the pass is not registered (i.e. the PassInfo is null).<br>
<br>
It doesn't seem worth going through the existing MachineFunction passes to add<br>
registration, as the new pass manager seems to not require registration for<br>
most passes, and in any case one would expect the -print-{after,before}-all<br>
flags to do what they say, and not silently skip certain passes.<br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D9482&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=szYi12H1Yf1HKc52e8iea1fWub-__QJxC5R0La0Hg8U&s=zjw3uiFAjwcWiLN9uNY6D0PMwhIO81wc9pvntfNoLHc&e=" target="_blank">http://reviews.llvm.org/D9482</a><br>
<br>
Files:<br>
  lib/IR/LegacyPassManager.cpp<br>
<br>
Index: lib/IR/LegacyPassManager.cpp<br>
===================================================================<br>
--- lib/IR/LegacyPassManager.cpp<br>
+++ lib/IR/LegacyPassManager.cpp<br>
@@ -100,13 +100,19 @@<br>
 /// This is a utility to check whether a pass should have IR dumped<br>
 /// before it.<br>
 static bool ShouldPrintBeforePass(const PassInfo *PI) {<br>
-  return PrintBeforeAll || ShouldPrintBeforeOrAfterPass(PI, PrintBefore);<br>
+  if (PrintBeforeAll && !(PI && PI->isAnalysis()))<br>
+    return true;<br>
+  return PI && !PI->isAnalysis() &&<br>
+         ShouldPrintBeforeOrAfterPass(PI, PrintBefore);<br>
 }<br>
<br>
 /// This is a utility to check whether a pass should have IR dumped<br>
 /// after it.<br>
 static bool ShouldPrintAfterPass(const PassInfo *PI) {<br>
-  return PrintAfterAll || ShouldPrintBeforeOrAfterPass(PI, PrintAfter);<br>
+  if (PrintAfterAll && !(PI && PI->isAnalysis()))<br>
+    return true;<br>
+  return PI && !PI->isAnalysis() &&<br>
+         ShouldPrintBeforeOrAfterPass(PI, PrintAfter);<br>
 }<br>
<br>
 /// isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions<br>
@@ -671,16 +677,16 @@<br>
     return;<br>
   }<br>
<br>
-  if (PI && !PI->isAnalysis() && ShouldPrintBeforePass(PI)) {<br>
+  if (ShouldPrintBeforePass(PI)) {<br>
     Pass *PP = P->createPrinterPass(<br>
       dbgs(), std::string("*** IR Dump Before ") + P->getPassName() + " ***");<br>
     PP->assignPassManager(activeStack, getTopLevelPassManagerType());<br>
   }<br>
<br>
   // Add the requested pass to the best available pass manager.<br>
   P->assignPassManager(activeStack, getTopLevelPassManagerType());<br>
<br>
-  if (PI && !PI->isAnalysis() && ShouldPrintAfterPass(PI)) {<br>
+  if (ShouldPrintAfterPass(PI)) {<br>
     Pass *PP = P->createPrinterPass(<br>
       dbgs(), std::string("*** IR Dump After ") + P->getPassName() + " ***");<br>
     PP->assignPassManager(activeStack, getTopLevelPassManagerType());<br>
<br>
EMAIL PREFERENCES<br>
  <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=szYi12H1Yf1HKc52e8iea1fWub-__QJxC5R0La0Hg8U&s=NRWADQpKp471Z_aPC2-XFEqqIwuQOS0KKsd-lsSfQcY&e=" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">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>