[llvm-dev] When I got a Operator by iterating a Value's User, how can I got the relevant Instruction?

周书林 via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 17 08:24:28 PDT 2021


Hi,

I am using IR to do some dataflow analysis, and I want to get the source
location related to the dataflow. In my thought, when I iterate the Users
of a Value, there should be an corresponding instruction, then I could get
source location from dbg info.

However, in some cases, I got some Operators as the Users of a Value, such
as GEPOperator, BitCastOperator, etc.
My question is, how could I got the corresponding instruction that use this
Operator as Operand?

For example, when I got the GEPOperator as follows, how could I get the
LoadInst?

*%39 = load i32, i32* getelementptr inbounds (%struct.TTT, %struct.TTT*
@ttt, i32 0, i32 2), align 8, !dbg !971*


Sincerely,
Shulin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210617/3a7e4ead/attachment.html>


More information about the llvm-dev mailing list