Re: JIT compiling with LLVM v9.0

From: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: JIT compiling with LLVM v9.0
Date: 2018-01-24 21:35:08
Message-ID: 3802608.mkVm2M9brZ@peanuts2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wednesday, January 24, 2018 8:20:38 AM CET Andres Freund wrote:
> As the patchset is large (500kb) and I'm still quickly evolving it, I do
> not yet want to attach it. The git tree is at
> in the jit branch
> tlog;h=refs/heads/jit
> to build --with-llvm has to be passed to configure, llvm-config either
> needs to be in PATH or provided with LLVM_CONFIG to make. A c++ compiler
> and clang need to be available under common names or provided via CXX /
> CLANG respectively.
> Regards,
> Andres Freund


I tried to build on Debian sid, using GCC 7 and LLVM 5. I used the following
to compile, using your branch @3195c2821d :

$ export LLVM_CONFIG=/usr/bin/llvm-config-5.0
$ ./configure --with-llvm
$ make

And I had the following build error :
llvmjit_wrap.cpp:32:10: fatal error: llvm-c/DebugInfo.h: No such file or
#include "llvm-c/DebugInfo.h"
compilation terminated.

In LLVM 5.0, it looks like DebugInfo.h is not available in llvm-c, only as a C
++ API in llvm/IR/DebugInfo.h.

For 'sport' (I have not played with LLVM API since more than one year), I
tried to fix it, changing it to the C++ include.

The DebugInfo related one was easy, only one function was used.
But I still could not build because the LLVM API changed between 5.0 and 6.0
regarding value info SummaryList.

llvmjit_wrap.cpp: In function
‘std::unique_ptr<llvm::StringMap<llvm::StringSet<> > >
llvmjit_wrap.cpp:285:48: error: ‘class llvm::GlobalValueSummary’ has no member
named ‘getBaseObject’
fs = llvm::cast<llvm::FunctionSummary>(gvs->getBaseObject());

That one was a bit uglier.

I'm not sure how to test everything properly, so the patch is attached for
both these issues, do as you wish with it… :)


Pierre Ducroquet

Attachment Content-Type Size
0001-Allow-building-with-LLVM-5.0.patch text/x-patch 2.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-01-24 21:39:49 Re: [HACKERS] UPDATE of partition key
Previous Message Andres Freund 2018-01-24 21:29:16 Re: pgsql: Add parallel-aware hash joins.