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

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 17 14:10:22 PDT 2021


Am Do., 17. Juni 2021 um 10:24 Uhr schrieb 周书林 via llvm-dev
<llvm-dev at lists.llvm.org>:
> %39 = load i32, i32* getelementptr inbounds (%struct.TTT, %struct.TTT* @ttt, i32 0, i32 2), align 8, !dbg !971

%39 is the LoadInst, while getelementptr is its second operand. It is
inlined because it is an llvm::Constant, not an instruction. Constants
do not participate in use/user-chains and hence there is no link from
GEP to the LoadInst that is using it. The constant GEP object may be
used by an arbitrary number of other instructions, other constants in
the same or other functions.

Node that there "GEPOperator" can represent either a GetElementPtrInst
(i.e. an instruction) or a GEP constant expression (derived from
ConstantExpr)

Michael


More information about the llvm-dev mailing list