Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9qGO-001oC7-0w for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 20:09:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9qGM-00BqS1-1i for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 20:09:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9qGL-00BqRs-1m for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 20:09:34 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9qGH-00000000xSb-2iqv for pgsql-hackers@postgresql.org; Mon, 06 Apr 2026 20:09:33 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id C260CEC043E; Mon, 6 Apr 2026 16:09:27 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Mon, 06 Apr 2026 16:09:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1775506167; x=1775592567; bh=QwbqO78ux0 OukqjqIM7paG+9xo8IHh3pOpMg07NtZfo=; b=fVnyeYJmbkQOTEp2GSGR+i5319 gTAVteFoB8Ifb5KqKkNT+EG0EGurHp1CnRY0E0m7MsS00FTPqfh3fYbQsZ/KpWPP KL+kBvRZ8N/bEKoKeRQSqQtUirwoHwaj12581aRBdkUdrJWe7HutE0GhHkwZlUKl +Dik+ot2otQG8Z8Rg9fRb9DjbGvfF6wK8xgp0bdP4mpgTWKGFbV0MEVlfUm1/zuv tjuyrlLN2STxfsJCzkd8li9QX2L0yfNJeIOuNZ8c6TrGGUIvOMU0E+w6Zk16dWP6 R43JtJxWG58dHSbZbF1bCNuK+TMG4KnnPJGVCZSH+ccKWxeLye/nzLEtePdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1775506167; x=1775592567; bh=QwbqO78ux0OukqjqIM7paG+9xo8IHh3pOpM g07NtZfo=; b=Wx0BdcTl8r0rqOO1mb4+sI+ML2Nlf+sdnl7g2YQoHb3ADLcLQRM AuYdDJwjcp+yo2Mi07Bj049IxrSqRkLjm4vNWGwnrP4IvEggQWLjUNDHU1w9L40q 0qWRGw9GdlKMhzPkzTIq8BWjz6jstqaUevD1qJyJ7DGK1dzgZBGprVGrt3R5E4l0 Ck9zfBIzsBDvyBUXV7ygbSocHjmiqsgy3/5MaM0vwS1u+FrJbcsOB2eN4Y6bUbpG F02ZWHNtTbPvspyCCLeXt1EYxIIi0VE3vTVxDwgNPPveYDI3XlehB/2M+BSYPOaS Hclz/93IPZmzCaQUOIatY0kcOygMNUK9KhA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddukeeiiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpeetnhgurhgvshcu hfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrghtth gvrhhnpeegtdevieefheejfeevleegheegieegffeihffgkeeltefhheeukeeufeelgedu udenucffohhmrghinhepphhoshhtghhrrdgvshenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgdp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvth gvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtohepsgihrghvuhiikedusehg mhgrihhlrdgtohhmpdhrtghpthhtohepiihsohhlthdrphgrrhhrrghgihesphgvrhgtoh hnrgdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgv shhqlhdrohhrgh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Apr 2026 16:09:27 -0400 (EDT) Date: Mon, 6 Apr 2026 16:09:26 -0400 From: Andres Freund To: Nazir Bilal Yavuz Cc: Zsolt Parragi , Peter Eisentraut , pgsql-hackers Subject: Re: meson vs. llvm bitcode files Message-ID: References: <4286824f-40c3-4716-ad71-2085b83f3736@eisentraut.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2026-03-26 14:27:15 +0300, Nazir Bilal Yavuz wrote: > From ca280ffa86c4b4804ce517414c7aae015d6d21ea Mon Sep 17 00:00:00 2001 > From: Andres Freund > Date: Sat, 27 Aug 2022 09:52:03 -0700 > Subject: [PATCH v12 1/7] meson: Add postgresql-extension.pc for building > extension libraries I don't think we have enough agreement for this with a name as general as this yet. What if we just have a postgresql-llvm-jit-bitcode or postgresql-$version-llvm-jit-bitcode for now? Then we also don't need the tests and the autoconf parts yet. > Subject: [PATCH v12 4/7] meson: Add architecture for LLVM bitcode emission > +foreach bitcode_module : bitcode_modules > + bitcode_targets = [] > + bitcode_obj = bitcode_module['target'] > + bitcode_cflags_local = bitcode_cflags + bitcode_module.get('additional_flags', []) > + bitcode_name = bitcode_module.get('name', bitcode_obj.name()) > + > + foreach srcfile : bitcode_module['srcfiles'] > + if meson.version().version_compare('>=0.59') > + srcfilename = fs.parent(srcfile) / fs.name(srcfile) > + else > + srcfilename = '@0@'.format(srcfile) > + endif > + > + targetname = '@0@_@1@.bc'.format( > + bitcode_name, > + srcfilename.underscorify(), > + ) > + bitcode_targets += custom_target( > + targetname, > + depends: [generated_backend_headers_stamp], One thing that's quite annoying about the dependencies is that somehow this makes meson a lot slower generating build.ninja. It takes 22s for me with the depend present, 5.1s without. One thing that seems to be fast, but is also somewhat ugly, is to use no depends but input: [srcfile, bitcode_obj.extract_objects(srcfile)], That works because llvm_irgen_command just uses '@INPUT0@', but still adds a dependency to the .o file, which in turn has the right dependencies. While a bit gross, it still seems far better than 4x ing the build.ninja generation time. > + # Process generated sources, which may include custom compilation flags. > + foreach gen_sources: bitcode_module.get('gen_sources', []) Are there actually cases where it makes sense to generate bitcode for these? I'm a bit doubtful. > From a4559525c8e9fa2999bf1d151dfe17bb83dc50f7 Mon Sep 17 00:00:00 2001 > From: Nazir Bilal Yavuz > Date: Mon, 16 Mar 2026 18:15:59 +0300 > Subject: [PATCH v12 5/7] meson: Add LLVM bitcode emissions for contrib > libraries > > The libraries which the bitcode files will be generated in are selected > manually. > > Author: Andres Freund > Author: Nazir Bilal Yavuz > Author: Diego Fronza > Reviewed-by: Peter Eisentraut > Reviewed-by: Diego Fronza > Reviewed-by: Zsolt Parragi > Discussion: https://postgr.es/m/206b001d-1884-4081-bd02-bed5c92f02ba%40eisentraut.org > --- > contrib/bloom/meson.build | 5 +++++ > contrib/bool_plperl/meson.build | 9 +++++++++ > contrib/btree_gin/meson.build | 5 +++++ > contrib/btree_gist/meson.build | 5 +++++ > contrib/citext/meson.build | 5 +++++ > contrib/cube/meson.build | 18 ++++++++++++++++++ > contrib/dict_int/meson.build | 5 +++++ > contrib/dict_xsyn/meson.build | 5 +++++ > contrib/earthdistance/meson.build | 6 ++++++ > contrib/fuzzystrmatch/meson.build | 9 +++++++++ > contrib/hstore/meson.build | 7 +++++++ > contrib/hstore_plperl/meson.build | 10 ++++++++++ > contrib/hstore_plpython/meson.build | 11 +++++++++++ > contrib/intarray/meson.build | 5 +++++ > contrib/isn/meson.build | 5 +++++ > contrib/jsonb_plperl/meson.build | 8 ++++++++ > contrib/jsonb_plpython/meson.build | 10 ++++++++++ > contrib/lo/meson.build | 5 +++++ > contrib/ltree/meson.build | 10 ++++++++++ > contrib/ltree_plpython/meson.build | 11 +++++++++++ > contrib/pg_buffercache/meson.build | 5 +++++ > contrib/pg_freespacemap/meson.build | 5 +++++ > contrib/pg_logicalinspect/meson.build | 5 +++++ > contrib/pg_surgery/meson.build | 4 ++++ > contrib/pg_trgm/meson.build | 5 +++++ > contrib/pgcrypto/meson.build | 4 ++++ > contrib/seg/meson.build | 12 ++++++++++++ > contrib/spi/meson.build | 20 ++++++++++++++++++++ > contrib/sslinfo/meson.build | 5 +++++ > contrib/tablefunc/meson.build | 5 +++++ > contrib/tcn/meson.build | 5 +++++ > contrib/tsm_system_rows/meson.build | 5 +++++ > contrib/tsm_system_time/meson.build | 5 +++++ > contrib/unaccent/meson.build | 5 +++++ > contrib/uuid-ossp/meson.build | 5 +++++ > contrib/xml2/meson.build | 5 +++++ > meson.build | 1 + > src/interfaces/libpq/meson.build | 3 +++ > src/pl/plperl/meson.build | 1 + > src/pl/plpython/meson.build | 1 + > 40 files changed, 260 insertions(+) I think for most of these don't make much sense to generate bitcode. I'd probably restrict it to hstore, citext, intarray, ltree, pg_trgm or such. There need to have lightweight SQL operators / functions to be considered for inlining, and that's just not the usecase most of these have. > From aa64b9ffc2b6aed9057568d616ab9e6c43af4b16 Mon Sep 17 00:00:00 2001 > From: Nazir Bilal Yavuz > Date: Wed, 12 Mar 2025 10:44:46 +0300 > Subject: [PATCH v12 6/7] meson: Add LLVM bitcode emission for backend sources > > Since generated backend sources may have their own compilation flags and > must also be included in the postgres.index.bc, the way to make it work > with current code was to create a new variable, called > `bc_generated_backend_sources`, which is a list of dictionaries, each > one having an optional 'additional_flags' and a `srclist` pointing to > the list of custom_target generated sources. > > An example of a possible structure of bitcode_modules which is processed > by the main meson llvm bitcode emission file > src/backend/jit/llvm/bitcode/meson.build: I'm a bit doubtful this is worth doing, I don't think anything in there could be potentially inlineable... Greetings, Andres Freund