[llvm-dev] [cfe-dev] Help needed in analyzing liveness of variables with LLVM IR

Madhur Amilkanthwar via llvm-dev llvm-dev at lists.llvm.org
Fri Apr 7 04:43:21 PDT 2017

Adding llvm-dev.

I don't know if this is readily available in LLVM but here is what you
could do something like below.

worklist = NULL
for each loop L in function {
  for each block B in L {
     for each Inst I in B {

        if (I.use_empty())

        for each use of I {
            B1 = I.getParent();

           if (L.contains(B))


Similar thing seems to be in Transforms/Utils/LCSSA.cpp

On Fri, Apr 7, 2017 at 11:01 AM, Shail Dave via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
> Thank you for your time in reading this. I need help in analyzing the
> live-in and live-out variables for few loops in the llvm IR. I want to
> figure out which is a live-variable at the end of the loop and what is
> live-in variable for the loop. I found that such provisions are available
> for machine instructions. But, I have to use this at IR level. I found few
> papers showing algorithms to construct such analysis but, it seems to me
> that this must be a problem encountered before and there should be at least
> similar functionalities in some of the analyses passes in the existing LLVM
> framework. It would be great if I can find some references or someone can
> give some suggestions.
> If I cannot find some existing passes, I am also not sure about – how can
> I make use of Intrinsic::invariant_start or Intrinsic::lifetime_start for
> aforementioned purpose. Any help is highly appreciated. Thanks!
> Best,
> *Shail*
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

*Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this
mail are of my own and my employer has no take in it. *
Thank You.
Madhur D. Amilkanthwar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170407/274ff146/attachment.html>

More information about the llvm-dev mailing list