周书林 via llvm-dev
2021-Jun-18 00:24 UTC
[llvm-dev] When I got a Operator by iterating a Value's User, how can I got the relevant Instruction?
Hi Michael, Thank you very much! I have a further question: if I want to get the dataflow of a target Value, is there any way to handle these situations when iterate the Users?Or only by iterator all the instructions and their operands? Sincerely, Shulin Michael Kruse <llvmdev at meinersbur.de> 于2021年6月18日周五 上午5:11写道:> 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210618/a384fa36/attachment.html>
Craig Topper via llvm-dev
2021-Jun-18 00:37 UTC
[llvm-dev] When I got a Operator by iterating a Value's User, how can I got the relevant Instruction?
How did you choose where you started from? An Instruction can only be used by another Instruction, but it seems you've started from a Constant which can be used by ConstantExprs. ~Craig On Thu, Jun 17, 2021 at 5:25 PM 周书林 via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi Michael, > > Thank you very much! > I have a further question: if I want to get the dataflow of a target > Value, is there any way to handle these situations when iterate the > Users?Or only by iterator all the instructions and their operands? > > Sincerely, > Shulin > > Michael Kruse <llvmdev at meinersbur.de> 于2021年6月18日周五 上午5:11写道: > >> 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 >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210617/6cb0355e/attachment.html>