[llvm-dev] Check if value operand to store instruction is defined in this instruction
alexp via llvm-dev
llvm-dev at lists.llvm.org
Tue Jan 22 06:37:16 PST 2019
Hi all,
the store instruction allows to define values, e.g.:
%ptr = alloca i32 ; yields i32*:ptr
store i32 3, i32* %ptr
lets name this 'type1 store'; this is different from 'type2 store'
%val = load i32, i32* %someptr
%ptr = alloca i32 ; yields i32*:ptr
store %val, i32* %ptr ; yields void
When now later on manipulating the instructions of a function, can I
tell if I deal with type1 or type 2 store?
In case of type1 I could e.g. alter the value; in type 2 not.
My best guess is something like:
storeInstructionInstance.getValueOperand.hasOneUse()
true: only used within this storeInstruction, else value is
introduced/used elsewhere.
Is this correct?
Thanks!
Alex
p.s.:
it's been a while since my last post to llvm-dev. Is this still the
place for such questions? If not, pleas point me where to ask this sort
of questions.
Thanks
More information about the llvm-dev
mailing list