1

for a IR like

%.0 = phi i32* [ @y, %bb2 ], [ @z, %bb3 ]
%.1 = phi i32* [ %.0, %bb4 ], [ %.x, %bb19 ]
store i32* %.1, i32** @x, align 8

So if I am iterating in my llvm-pass and encounter use of 0.1 at third instruction. I store it in value class (using Instruction->getOperand(0)) let say with name v1. Now how can I iterate through variables which 0.1 may hold which are y,z and x.What to call on v1.

I have tried reading llvm documentation and the following link but there is no syntax given for llvm-passes

https://llvm.org/docs/MemorySSA.html I am trying following code

for (auto &I : BB) {//over basic blocks
    Instruction *Inst=&I;
    if(Inst->getOpcode()==31){
        Value *v=Inst->getOperand(0);
        //now use what to get x,y,z as through 0.1
    }
}

0 Answers0