You can get all users of one instruction like this:
* for(Value::user_iterator i = inst->user_begin(), ie = inst->user_end();
i!=ie; ++i) *
* {*
* .....*
* }*
To check if one instruction is used or not, just check if the number of
users is zero. Hope this helps,
Xiangyang
2015-11-10 21:56 GMT-05:00 Valiant wang via llvm-dev <
llvm-dev at lists.llvm.org>:
> I want to know if %3 will be used or not in the following code, when I try
> to phrase line 36, but I don't how to judge. Anyone knows? Please give
me
> some help,thanks!
>
> 31 define i32 @main() #0 {
> 32 %1 = alloca i32, align 4
> 33 %vara = alloca i32, align 4
> 34 store i32 0, i32* %1
> 35 %2 = load i32* %vara, align 4
> 36 %3 = call i32 @func(i32 %2)
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://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/20151110/5f87c854/attachment-0001.html>