<div dir="ltr">Hi Son,<div><br></div><div>I have an answer to your first question:<br><div><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>1, What are the differences between <b>LegacyPassManager</b> and <b>PassManager</b>?  I see that <b>opt</b> uses the former most of the times while the latter is used via <b>PassBuilder</b> API when an user wants to build her own pipeline, but I have no idea why so. What to use and when to use it is not clear to me.</div></div></blockquote><div>PassManager is the result of a long going effort to replace the default pass manager of opt and clang. Here's the original RFC containing the motivation: <a href="http://lists.llvm.org/pipermail/llvm-dev/2012-July/051643.html">http://lists.llvm.org/pipermail/llvm-dev/2012-July/051643.html</a></div><div><br></div><div>LegacyPassManager is currently still the default, but we are really close to switching over the the new one. Both opt and clang have switches to enable the new one, by calling `opt -passes="...."` or `clang -fexperimental-new-pass-manager`. PassBuilder is essentially a big factory to produce PassManager and AnalysisManager objects for the passes and analyses included in core LLVM. If you develop analyses and passes, I'd suggest doing so against the new PM, especially if you plan on upstreaming your work.</div><div><br></div><div>Cheers,</div><div>Philip</div></div></div></div></div></div>