[llvm-dev] Back tracing Variables

Juan Ceasar via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 23 05:55:03 PST 2016


Good Morning - Happy Holidays everyone!

I had a question about the best way to do back tracing of variables via the IR.  So for example, if I have the following simple IR:

define i32 @squak(i32 %num) #0 {
  %1 = alloca i32, align 4
  store i32 %num, i32* %1, align 4
  %2 = load i32, i32* %1, align 4
  %3 = icmp sgt i32 %2, 10

I’m grabbing the predicate of “icmp”, which in this case is a simple test “>”  of the input “%num" and the constant “10" and I want to trace back to “%num" via the slots/virtual registers %2 and %1.  I believe I can do this via the SlotTracker (in AsmWriter.cpp) but I wonder if there’s a better, more direct way?  Any suggestions?  I’m basically trying to track predicate formation in the IR and hence the need…

Thanks for any help!




More information about the llvm-dev mailing list