title: LLVM get constant integer back from Value*
body: <p>I create a llvm::Value* from a integer constant like this:</p>
  
  <pre><code>llvm::Value* constValue = llvm::ConstantInt::get( llvmContext , llvm::APInt( node-&gt;someInt() ));
  </code></pre>
  
  <p>now i want to retrieve the compile-time constant value back;</p>
  
  <pre><code>int constIntValue = constValue-&gt;???
  </code></pre>
  
  <p>The examples shown in <a href="http://llvm.org/docs/ProgrammersManual.html#isa">LLVM Programmer manual</a> seem to imply that cast&lt;> will accept a pointer when using the type (rather than the type plus pointer) template parameter, however i'm pretty sure thats failing as from 2.8:</p>
  
  <pre><code>llvm::Value* foo = 0;
  llvm::ConstantInt* intValue = &amp; llvm::cast&lt; llvm::ConstantInt , llvm::Value &gt;(foo );
  
  //build error:
  //error: no matching function for call to ‘cast(llvm::Value*&amp;)’
  </code></pre>
  
  <p>What would be the correct approach here?</p>