David Blaikie via llvm-dev
2021-Feb-24 21:01 UTC
[llvm-dev] LLVM data structures between modules
If you want to do cross-file optimization, you're looking for/want to use something like LTO or ThinLTO. (see, for instance, the whole program devirtualization work done with ThinLTO recently) On Wed, Feb 24, 2021 at 12:28 PM Mohannad Ismail via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Greetings everyone, > > I currently have a pass (Pass 2) that does some transformations. What I > want to do is to have a pass (Pass 1) that runs before Pass 2, collects > some IR information, stores it in a data structure and passes the data > structure to Pass 2 so that I can use it for specific transformations. I > think this can be done with getAnalysisUsage, but I'm not sure how. I would > like to know how to do that exactly, if it's possible. > > Another thing, and this is the tricky part, is that I want Pass 1 to run > on all the source files I have first before Pass 2 runs and pass a > collective data structure to Pass 2. In other words, I want Pass 1 to run > across all the modules and source files first, collect information, pass it > to Pass 2 then Pass 2 runs. Is there a way to tell LLVM to do this type of > "double compilation"? > > Hope I was able to explain this well enough. Please let me know if I > wasn't clear or if you have any questions. Thank you very much! > > Best regards, > Mohannad Ismail > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210224/e3572f66/attachment.html>
Mohannad Ismail via llvm-dev
2021-Feb-24 21:25 UTC
[llvm-dev] LLVM data structures between modules
Thank you for your reply! Correct me if I'm wrong, but doesn't LTO kick in after the compilation phase? My current pass makes instrumentations and the pass I want to run before it won't make any instrumentations. So what I am thinking is that one would be an analysis pass and the other would be a transformation pass.>From what I understand, instrumentation passes run first beforeoptimization and linking, thus LTO might not help with that. Do I need to convert my passes to be optimization passes to take advantage of LTO? How do I do that? Thank you for your help and support! On Wed, Feb 24, 2021 at 4:01 PM David Blaikie <dblaikie at gmail.com> wrote:> If you want to do cross-file optimization, you're looking for/want to use > something like LTO or ThinLTO. (see, for instance, the whole program > devirtualization work done with ThinLTO recently) > > On Wed, Feb 24, 2021 at 12:28 PM Mohannad Ismail via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Greetings everyone, >> >> I currently have a pass (Pass 2) that does some transformations. What I >> want to do is to have a pass (Pass 1) that runs before Pass 2, collects >> some IR information, stores it in a data structure and passes the data >> structure to Pass 2 so that I can use it for specific transformations. I >> think this can be done with getAnalysisUsage, but I'm not sure how. I would >> like to know how to do that exactly, if it's possible. >> >> Another thing, and this is the tricky part, is that I want Pass 1 to run >> on all the source files I have first before Pass 2 runs and pass a >> collective data structure to Pass 2. In other words, I want Pass 1 to run >> across all the modules and source files first, collect information, pass it >> to Pass 2 then Pass 2 runs. Is there a way to tell LLVM to do this type of >> "double compilation"? >> >> Hope I was able to explain this well enough. Please let me know if I >> wasn't clear or if you have any questions. Thank you very much! >> >> Best regards, >> Mohannad Ismail >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210224/941fef55/attachment.html>