Re: JIT compiling with LLVM v9.0 - Mailing list pgsql-hackers

From Pierre Ducroquet
Subject Re: JIT compiling with LLVM v9.0
Date
Msg-id 3802608.mkVm2M9brZ@peanuts2
Whole thread Raw
In response to JIT compiling with LLVM v9.0  (Andres Freund <andres@anarazel.de>)
Responses Re: JIT compiling with LLVM v9.0
Re: JIT compiling with LLVM v9.0
List 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
>   https://git.postgresql.org/git/users/andresfreund/postgres.git
> in the jit branch
>
> https://git.postgresql.org/gitweb/?p=users/andresfreund/postgres.git;a=shor
> 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

Hi

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
directory
 #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<> > >
llvm_build_inline_plan(llvm::Module*)’:
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… :)

Regards

 Pierre Ducroquet


Attachment

pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: PATCH: Exclude unlogged tables from base backups
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] UPDATE of partition key