Given an instruction and the basic block that it's in, is there an easy way to tell if the operands are ever referenced after the instruction? For example, if i have ... %mul = mul nsw i32 %a, %val %add = add nsw i32 %b, %val ... And I'm iterating through this basic block, can I tell when I get to the multiply instruction that another instruction is going to be using %val? Since I'm running my code through reg2mem, I don't really care much about other basicblocks (anything outside the basicblock should have an eliminated phi instruction so it will be pulled from memory anyways). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120716/8ea31fd2/attachment.html>
Hi Ryan,> Given an instruction and the basic block that it's in, is there an easy way to > tell if the operands are ever referenced after the instruction?if the operand only has one use (->hasOneUse()) then you know it. Otherwise it is more tricky. Why do you care? Ciao, Duncan.> > For example, if i have > ... > %mul = mul nsw i32 %a, %val > %add = add nsw i32 %b, %val > ... > > And I'm iterating through this basic block, can I tell when I get to the > multiply instruction that another instruction is going to be using %val? > > Since I'm running my code through reg2mem, I don't really care much about other > basicblocks (anything outside the basicblock should have an eliminated phi > instruction so it will be pulled from memory anyways). > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Reasonably Related Threads
- [LLVMdev] Inneffiecient code produced by reg2mem?
- [LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
- [LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
- [LLVMdev] Specify dominator for BasicBlock to avoid "Instruction does not dominate all uses!"
- [LLVMdev] TableGen pattern for negated operand