<div dir="ltr">Hi All<div><br></div><div>While working on a LoopNest pass, I hit 'unreachable code' in the getIRName, which is invoked as part of debugging options (like -debug-pass-manager). It is figured out that within getIRName, LoopNest is not handled. I could fix it with the following patch.</div><div><br></div><div>diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp<br>index e64df0b1147f..65e0e7d4cf27 100644<br>--- a/llvm/lib/Passes/StandardInstrumentations.cpp<br>+++ b/llvm/lib/Passes/StandardInstrumentations.cpp<br>@@ -20,6 +20,7 @@<br> #include "llvm/Analysis/LazyCallGraph.h"<br> #include "llvm/Analysis/LoopInfo.h"<br> #include "llvm/IR/Function.h"<br>+#include "llvm/Analysis/LoopNestAnalysis.h" <br> #include "llvm/IR/Module.h"<br> #include "llvm/IR/PassInstrumentation.h"<br> #include "llvm/IR/PassManager.h"<br>@@ -285,6 +286,17 @@ std::string getIRName(Any IR) {<br>     return OS.str();<br>   }<br> <br>+  if (any_isa<const LoopNest *>(IR)) {<br>+    const Loop *L = &any_cast<const LoopNest *>(IR)->getOutermostLoop();<br>+    std::string S;<br>+    raw_string_ostream OS(S);<br>+    assert(L && "Loop should be valid for printing");<br>+    L->print(OS, /*Verbose*/ false, /*PrintNested*/ false);<br>+    return OS.str();<br>+  }<br>+<br>   llvm_unreachable("Unknown wrapped IR type");<br> }</div><div><br></div><div>Just wanted to make sure that this is the right fix and if it is so we can upstream this change.</div><div><br></div><div>Regards,</div><div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>------------------------------</div><div>Raghesh Aloor</div><div>AMD India Pvt. Ltd.</div><div>Bengaluru.</div><div>------------------------------</div></div></div></div></div></div></div></div></div></div>