Help needed in analyzing liveness of variables with LLVM IR

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help needed in analyzing liveness of variables with LLVM IR

Richard Pennington via cfe-dev

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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help needed in analyzing liveness of variables with LLVM IR

Richard Pennington via cfe-dev
+cfe dev

On Fri, Apr 7, 2017 at 5:13 PM, Madhur Amilkanthwar <[hidden email]> wrote:
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()) 
           continue; 

        for each use of I {
            B1 = I.getParent();
 
           if (L.contains(B))
                continue;
            
            worklist.add(I)
            break;
        }      
     }
   }
}

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


On Fri, Apr 7, 2017 at 11:01 AM, Shail Dave via cfe-dev <[hidden email]> 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
[hidden email]
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




--
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


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...