LLVM IR: Get LVALUE operand
<p>I have following instruction:</p>

<pre><code>%ptrA = getelementptr float, float addrspace(1)* %A, i32 %id
</code></pre>

<p>I can get the operands <code>%A</code> and <code>%id</code> using <code>getOperand(0)</code> and <code>getOperand(1)</code>. I was wondering if <code>getOperand</code> will work on <code>%ptrA</code>? If yes, would it be <code>getOperand(3)</code>?</p>

<p>------------------------------------Edit----------------------------</p>

<p>So I changed my code as follows:</p>

<pre><code>for (Instruction &amp;I : instructions(F)){
    if (cast&lt;Operator&gt;(I).getOpcode() == Instruction::GetElementPtr){
        Value* AddrPointer = cast&lt;Value&gt;(I);
</code></pre>

<p>I keep getting error:</p>

<pre class="lang-none prettyprint-override"><code>error: cannot convert ‘llvm::Value’ to ‘llvm::Value*’ in initialization
       Value* AddrPointer = cast&lt;Value&gt;(I);
                                         ^
</code></pre>

<p>I see that there is some problem with type mismatch.</p>

<p>Thank you.</p>