title: LLVMVerifyFunction: Instruction does not dominate all uses
body: <p>What's wrong with following snippet? I'm getting "Instruction does not dominate all uses" in <code>LLVMVerifyFunction</code>:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #include &lt;llvm-c/Core.h&gt;
  #include &lt;llvm-c/Analysis.h&gt;
  
  int main() {
      LLVMModuleRef module = LLVMModuleCreateWithName("test");
      LLVMBuilderRef builder = LLVMCreateBuilder();
  
      LLVMTypeRef params = LLVMDoubleType();
      LLVMTypeRef type = LLVMFunctionType(
                                          LLVMDoubleType(),
                                          &amp;params,
                                          1,
                                          0);
  
      LLVMValueRef function = LLVMAddFunction(module, "foo", type);
      LLVMSetLinkage(function, LLVMExternalLinkage);
  
      LLVMValueRef param = LLVMGetParam(function, 0);
      LLVMSetValueName(param, "a");
  
      LLVMDumpValue(function);
  
      LLVMValueRef one = LLVMConstReal(LLVMDoubleType(), 1);
      LLVMValueRef instr = LLVMBuildFAdd(builder, param, one, "addtmp");
  
      LLVMBasicBlockRef block = LLVMAppendBasicBlock(function, "entry");
      LLVMPositionBuilderAtEnd(builder, block);
      LLVMBuildRet(builder, instr);
  
      // Verify function.
      if (LLVMVerifyFunction(function, LLVMPrintMessageAction) == 1) {
          LLVMDeleteFunction(function);
          printf("bad");
      }
  
      LLVMDisposeBuilder(builder);
      LLVMDisposeModule(module);
  
      return 0;
  }
  </code></pre>