Re: LLVM 16 (opaque pointers)

From: Ronan Dunklau <ronan(dot)dunklau(at)aiven(dot)io>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: LLVM 16 (opaque pointers)
Date: 2023-08-10 14:56:54
Message-ID: 6965583.LvFx2qVVIh@aivenlaptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Le dimanche 21 mai 2023, 05:01:41 CEST Thomas Munro a écrit :
> Hi,
> Here is a draft version of the long awaited patch to support LLVM 16.
> It's mostly mechanical donkeywork, but it took some time: this donkey
> found it quite hard to understand the mighty getelementptr
> instruction[1] and the code generation well enough to figure out all
> the right types, and small mistakes took some debugging effort*. I
> now finally have a patch that passes all tests.
> Though it's not quite ready yet, I thought I should give this status
> update to report that the main task is more or less complete, since
> we're starting to get quite a few emails about it (mostly from Fedora
> users) and there is an entry for it on the Open Items for 16 wiki
> page. Comments/review/testing welcome.

Hello Thomas,

Thank you for this effort !

I've tested it against llvm 15 and 16, and found no problem with it.

> 6. I need to go through the types again with a fine tooth comb, and
> check the test coverage to look out for eg GEP array arithmetic with
> the wrong type/size that isn't being exercised.

I haven't gone through the test coverage myself, but I exercised the following

- running make installcheck with jit_above_cost = 0
- letting sqlsmith hammer random queries at it for a few hours.

This didn't show obvious issues.

> *For anyone working with this type of IR generation code and
> questioning their sanity, I can pass on some excellent advice I got
> from Andres: build LLVM yourself with assertions enabled, as they
> catch some classes of silly mistake that otherwise just segfault
> > inscrutably on execution.

I tried my hand at backporting it to previous versions, and not knowing
anything about it made me indeed question my sanity. It's quite easy for PG
15, 14, 13. PG 12 is nothing insurmontable either, but PG 11 is a bit hairier
most notably due to to the change in fcinfo args representation. But I guess
that's also a topic for another day :-)

Best regards,

Ronan Dunklau

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-08-10 14:59:52 Re: Fix last unitialized memory warning
Previous Message Melih Mutlu 2023-08-10 14:54:02 Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication