<div dir="ltr">Are you sure you are initializing your pass properly?  Can you show a stripped down version of your pass?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 21, 2013 at 7:27 AM, Anthony Yu <span dir="ltr"><<a href="mailto:swpenim@gmail.com" target="_blank">swpenim@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I want to write a modulePass in addPreEmitPass() for NVPTX, but I encounter an assertion failed when executing clang.</div>
<div><br></div><div>Here is my error message.</div>
<div>====<br></div><div><div>Pass 'NVPTX Assembly Printer' is not initialized.</div><div>Verify if there is a pass dependency cycle.</div><div>Required Passes:</div><div>llc: /home/pyyu/local/llvm/lib/IR/PassManager.cpp:637: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed.</div>

<div>0  llc             0x000000000176cd86 llvm::sys::PrintStackTrace(_IO_FILE*) + 38</div><div>1  llc             0x000000000176d00d</div><div>2  llc             0x000000000176ca5c</div><div>3  libpthread.so.0 0x00007f9867638cb0</div>

<div>4  libc.so.6       0x00007f986688a425 gsignal + 53</div><div>5  libc.so.6       0x00007f986688db8b abort + 379</div><div>6  libc.so.6       0x00007f98668830ee</div><div>7  libc.so.6       0x00007f9866883192</div>
<div>8  llc             0x00000000016ec3b1 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 983</div><div>9  llc             0x00000000016f2990</div><div>10 llc             0x00000000016f0e91 llvm::PassManager::add(llvm::Pass*) + 39</div>

<div>11 llc             0x00000000011c119b llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::PassManagerBase&, llvm::formatted_raw_ostream&, llvm::TargetMachine::CodeGenFileType, bool, void const*, void const*) + 1705</div>

<div>12 llc             0x00000000008c08b5</div><div>13 llc             0x00000000008bf8cd main + 237</div><div>14 libc.so.6       0x00007f986687576d __libc_start_main + 237</div><div>15 llc             0x00000000008bf229</div>

<div>=====</div><div><br></div><div>What my modulePass does is to print all of the function name in the module. </div><div>I use setPreservesAll() in getAnalysisUsage(), so there isn't any pass dependency cycle.<br>
</div><div><br></div><div>I notice that NVPTXAsmPrinter says it does static initialization. I'm not sure if it is related to this error.</div><div><br></div><div>Is there any advice to solve this error? And I also want to know if there is a way to verify if there is a pass dependency cycle.</div>

<div><br></div><div><br></div><div>Thanks for any advice.</div><div>Antony Yu</div><div>
<br></div><div><br></div></div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div>
</div>