llvm ir

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)

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