title: Value* to Instruction*/LoadInst* casting
body: <p>Can you please tell me if it is possible in LLVM to cast a <code>Value*</code> to an <code>Instruction*/LoadInst*</code> if for example <code>isa&lt;LoadInst&gt;(MyValue)</code> is true? In my particular piece of code:</p>
  
  <pre><code>Value* V1 = icmpInstrArray[i]-&gt;getOperand(0);
  Value* V2 = icmpInstrArray[i]-&gt;getOperand(1);
  if (isa&lt;LoadInst&gt;(V1) || isa&lt;LoadInst&gt;(V2)){
  ...
  if(isa&lt;LoadInst&gt;(icmpInstrArray[i]-&gt;getOperand(0)))
      LoadInst *LD100 = cast&lt;LoadInst&gt;(icmpInstrArray[i]-&gt;getOperand(0));
          Value *C100 = LD100-&gt;getPointerOperand(); //HERE COMPILATION ERROR
  </code></pre>
  
  <p>Further, I just need to make <code>C100-&gt;getName()</code> and I will get the loaded variable.</p>
  
  <p>The compilation error is : <code>error: ‘LD100’ was not declared in this scope.</code></p>
  
  <p>I don't think that I can use cast like that. Can you tell me a method to obtain the loaded variable from a Load instruction correspondent to my ICMP instructions? Or better how I can extract the Load instruction from <code>icmpInstrArray[i]-&gt;getOperand(0)</code>?</p>