title: LLVM IR: get the return value of the callsite
body: <p>Here is a quick question on analyzing LLVM IR. So basically I am trying to fetch the return value of the LLVM IR function call statement, something like this:</p>
  
  <pre><code>%47  =   call i256 @test(i256 %46)
  </code></pre>
  
  <p>I want to get access <code>%47</code>.</p>
  
  <p>And this is the code I have been using to access the parameter. </p>
  
  <pre><code>      else if (funcName.contains("test")) {
          Value *op = CI-&gt;getOperand(0);
          if (GetElementPtrInst *GEP = dyn_cast&lt;GetElementPtrInst&gt;(op))
            // get the first function parameter
            op = GEP-&gt;getPointerOperand();
        }
  </code></pre>
  
  <p>The very suprising finding is that I just cannot find something like "get return value" or so in the document: <a href="http://llvm.org/doxygen/classllvm_1_1CallInst.html" rel="nofollow noreferrer">http://llvm.org/doxygen/classllvm_1_1CallInst.html</a></p>
  
  <p>Could anyone shed some lights here? Thanks a lot.</p>