[llvm-dev] Find the instructions where a particular value is defined

Tim Northover via llvm-dev
Thu, 28 Jan 2016 01:15:46 -0000

On 27 January 2016 at 17:08, Syed Rafiul Hussain via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I am wondering if there is anything like def-use chain which finds all
> the instructions of a function where a particular value is defined?

How do you mean? LLVM IR is in SSA form, which means that each Value
has precisely one definition (which may or may not be an instruction).
If you've got a "Value *V" in C++ you can just
"dyn_cast<Instruction>(V)" to find the instruction (again, if it
exists).

Cheers.

Tim.