<div dir="ltr">> For the new pass manager I think you have to add your pass to llvm/lib/Passes/PassRegistry.def.<br><br>Oh ok, I'll try it.<div><br></div><div>> I’d recommend taking a look at how the DominatorTree analysis is set up. Also note that analysis passes on their own are invoked a little bit differently to transformation passes: old PM:  `opt -domtree -analyze foo.ll`, new PM: `opt  -passes='print<domtree>’ foo.ll`<br><br></div><div>I'll take a look, but the way I see it, copying passes ends up being more complicated.</div><div><br></div><div>> IIRC the tutorial is mostly focusing on out-of-tree passes, so the steps are different to an in-tree pass. It looks like the in-tree docs also mostly cover out-of-tree passes (<a href="http://llvm.org/docs/WritingAnLLVMPass.html" rel="noreferrer" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a>). Improvements to the docs in that area would definitely be welcomed.</div><div><br></div><div>I don't necessarily want an in-tree pass and the way I see it I better stick to:<br>- Old pass manager</div><div>- Out-of-tree passes</div><div><br></div><div>at least for now.</div><div><br></div><div>> Just in case you are not aware, there is already infrastructure to create runtime checks for dependences in loops in tree: <a href="https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp</a></div><br><div>Yep, I know, although I have to look more into that. The thing is, I pretty much understand all the theoretical background of DependenceAnalysis,</div><div>the way it is implemented is very clear and I somewhat can think how to use its dependence tests to create run-time checks.</div><div>So I wanted to experiment to see how much of LoopAccessAnalysis I'll need.</div><div><br></div><div>Because LoopAccessAnalysis on the other hand, maybe partly because it's focused on the loop vectorizer, is not at all clear to me. :)</div><div><br></div><div>Thanks for the help,</div><div>Stefanos</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Στις Παρ, 22 Μαΐ 2020 στις 6:20 μ.μ., ο/η Florian Hahn <<a href="mailto:florian_hahn@apple.com">florian_hahn@apple.com</a>> έγραψε:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On May 22, 2020, at 15:42, Stefanos Baziotis via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Hi,<br>
> <br>
> I want to create a copy of DependenceAnalysis downstream.<br>
> <br>
> At first I tried the HelloWorld tutorial. But then I figured, maybe I should move on<br>
> to create my pass by mimicking some other pass in LLVM.<br>
> <br>
> So, I tried copying DependenceAnalysis itself [1]<br>
> <br>
> Although after a lot of time of trying it compiled, I'm pretty sure I have done it<br>
> completely in the wrong way. What is more, I can't access my pass with the argument<br>
> I put (-rt-dep-checks).<br>
> <br>
<br>
For the new pass manager I think you have to add your pass to llvm/lib/Passes/PassRegistry.def. <br>
<br>
I’d recommend taking a look at how the DominatorTree analysis is set up. Also note that analysis passes on their own are invoked a little bit differently to transformation passes: old PM:  `opt -domtree -analyze foo.ll`, new PM: `opt  -passes='print<domtree>’ foo.ll`<br>
<br>
> Then, I watched this tutorial [2]. Apart from the fact that there seem to be<br>
> way too many steps just to create hello world pass, I don't think that passes like<br>
> DependenceAnalysis follow it.<br>
<br>
IIRC the tutorial is mostly focusing on out-of-tree passes, so the steps are different to an in-tree pass. It looks like the in-tree docs also mostly cover out-of-tree passes (<a href="http://llvm.org/docs/WritingAnLLVMPass.html" rel="noreferrer" target="_blank">http://llvm.org/docs/WritingAnLLVMPass.html</a>). Improvements to the docs in that area would definitely be welcomed.<br>
<br>
<br>
> [1] <a href="https://github.com/baziotis/llvm-project/tree/dep_analysis" rel="noreferrer" target="_blank">https://github.com/baziotis/llvm-project/tree/dep_analysis</a><br>
<br>
I had a quick look and it looks like your new pass is called RuntimeDependenceChecks. <br>
<br>
Just in case you are not aware, there is already infrastructure to create runtime checks for dependences in loops in tree: <a href="https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/blob/master/llvm/lib/Analysis/LoopAccessAnalysis.cpp</a><br>
<br>
Cheers,<br>
Florian</blockquote></div>