On 01/24/2018 08:20 AM, Andres Freund wrote: > Hi, > > I've spent the last weeks working on my LLVM compilation patchset. In > the course of that I *heavily* revised it. While still a good bit away > from committable, it's IMO definitely not a prototype anymore. > > There's too many small changes, so I'm only going to list the major > things. A good bit of that is new. The actual LLVM IR emissions itself > hasn't changed that drastically. Since I've not described them in > detail before I'll describe from scratch in a few cases, even if things > haven't fully changed. >
Hi, I wanted to look at this, but my attempts to build the jit branch fail with some compile-time warnings (uninitialized variables) and errors (unknown types, incorrect number of arguments). See the file attached. I wonder if I'm doing something wrong, or if there's something wrong with my environment. I do have this: $ clang -v clang version 5.0.0 (trunk 299717) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Writing fmgroids.h Writing fmgrprotos.h Writing fmgrtab.c Writing postgres.bki Writing schemapg.h Writing postgres.description Writing postgres.shdescription ../../../src/include/lib/simplehash.h: In function ‘tuplehash_insert’: execGrouping.c:428:28: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized] econtext->ecxt_innertuple = slot; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ execGrouping.c:402:18: note: ‘slot’ was declared here TupleTableSlot *slot; ^~~~ ../../../src/include/lib/simplehash.h: In function ‘tuplehash_lookup’: execGrouping.c:428:28: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized] econtext->ecxt_innertuple = slot; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ execGrouping.c:402:18: note: ‘slot’ was declared here TupleTableSlot *slot; ^~~~ ../../../src/include/lib/simplehash.h: In function ‘tuplehash_delete’: execGrouping.c:428:28: warning: ‘slot’ may be used uninitialized in this function [-Wmaybe-uninitialized] econtext->ecxt_innertuple = slot; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ execGrouping.c:402:18: note: ‘slot’ was declared here TupleTableSlot *slot; ^~~~ llvmjit.c: In function ‘llvm_get_function’: llvmjit.c:239:45: warning: passing argument 2 of ‘LLVMOrcGetSymbolAddress’ from incompatible pointer type [-Wincompatible-pointer-types] if (LLVMOrcGetSymbolAddress(llvm_opt0_orc, &addr, mangled)) ^ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:129:22: note: expected ‘const char *’ but argument is of type ‘LLVMOrcTargetAddress * {aka long unsigned int *}’ LLVMOrcTargetAddress LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack, ^~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:239:6: error: too many arguments to function ‘LLVMOrcGetSymbolAddress’ if (LLVMOrcGetSymbolAddress(llvm_opt0_orc, &addr, mangled)) ^~~~~~~~~~~~~~~~~~~~~~~ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:129:22: note: declared here LLVMOrcTargetAddress LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack, ^~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:243:45: warning: passing argument 2 of ‘LLVMOrcGetSymbolAddress’ from incompatible pointer type [-Wincompatible-pointer-types] if (LLVMOrcGetSymbolAddress(llvm_opt3_orc, &addr, mangled)) ^ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:129:22: note: expected ‘const char *’ but argument is of type ‘LLVMOrcTargetAddress * {aka long unsigned int *}’ LLVMOrcTargetAddress LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack, ^~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:243:6: error: too many arguments to function ‘LLVMOrcGetSymbolAddress’ if (LLVMOrcGetSymbolAddress(llvm_opt3_orc, &addr, mangled)) ^~~~~~~~~~~~~~~~~~~~~~~ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:129:22: note: declared here LLVMOrcTargetAddress LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack, ^~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c: In function ‘llvm_compile_module’: llvmjit.c:383:3: error: unknown type name ‘LLVMSharedModuleRef’ LLVMSharedModuleRef smod; ^~~~~~~~~~~~~~~~~~~ llvmjit.c:388:10: warning: implicit declaration of function ‘LLVMOrcMakeSharedModule’ [-Wimplicit-function-declaration] smod = LLVMOrcMakeSharedModule(context->module); ^~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:389:48: warning: passing argument 2 of ‘LLVMOrcAddEagerlyCompiledIR’ from incompatible pointer type [-Wincompatible-pointer-types] if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, smod, ^ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:98:1: note: expected ‘LLVMModuleRef {aka struct LLVMOpaqueModule *}’ but argument is of type ‘LLVMOrcModuleHandle * {aka unsigned int *}’ LLVMOrcAddEagerlyCompiledIR(LLVMOrcJITStackRef JITStack, LLVMModuleRef Mod, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:389:61: warning: passing argument 3 of ‘LLVMOrcAddEagerlyCompiledIR’ makes pointer from integer without a cast [-Wint-conversion] if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, smod, ^~~~ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:98:1: note: expected ‘LLVMOrcSymbolResolverFn {aka long unsigned int (*)(const char *, void *)}’ but argument is of type ‘int’ LLVMOrcAddEagerlyCompiledIR(LLVMOrcJITStackRef JITStack, LLVMModuleRef Mod, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:389:7: error: too many arguments to function ‘LLVMOrcAddEagerlyCompiledIR’ if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &orc_handle, smod, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from llvmjit.c:45:0: /usr/local/include/llvm-c/OrcBindings.h:98:1: note: declared here LLVMOrcAddEagerlyCompiledIR(LLVMOrcJITStackRef JITStack, LLVMModuleRef Mod, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ llvmjit.c:394:3: warning: implicit declaration of function ‘LLVMOrcDisposeSharedModuleRef’ [-Wimplicit-function-declaration] LLVMOrcDisposeSharedModuleRef(smod); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[3]: *** [<builtin>: llvmjit.o] Error 1 make[2]: *** [common.mk:45: lib-recursive] Error 2 make[2]: *** Waiting for unfinished jobs.... execGrouping.c:406:6: warning: variable 'slot' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (tuple == NULL) ^~~~~~~~~~~~~ execGrouping.c:428:30: note: uninitialized use occurs here econtext->ecxt_innertuple = slot; ^~~~ execGrouping.c:406:2: note: remove the 'if' if its condition is always true if (tuple == NULL) ^~~~~~~~~~~~~~~~~~ execGrouping.c:402:22: note: initialize the variable 'slot' to silence this warning TupleTableSlot *slot; ^ = NULL 1 warning generated. make[1]: *** [Makefile:38: install-backend-recurse] Error 2 make: *** [GNUmakefile:11: install-src-recurse] Error 2