[llvm-dev] Efficient way to identify an instruction

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 27 03:53:38 PDT 2019


Hi Alberto,

On Sat, 27 Jul 2019 at 10:09, Alberto Barbaro via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Having the reference I to the instruction in bold.Can i efficiently know that the variable %11 was "created" by the %3 = alloca [40 x i8], align 16.

Yes, I.getOperand(0) *is* the AllocaInst in this case. So for example
isa<AllocaInst>(I.getOperand(0)) will return true. And if you care
about more details you can dyn_cast<AllocaInst> it and check any other
properties you want.

Cheers.

Tim.


More information about the llvm-dev mailing list