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 1vcuM2-00C2Ik-2X for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Jan 2026 23:51:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vcuM1-004ypq-2R for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Jan 2026 23:51:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vcuM1-004ypi-1S for pgsql-hackers@lists.postgresql.org; Mon, 05 Jan 2026 23:51:18 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vcuM0-004PPi-2p for pgsql-hackers@lists.postgresql.org; Mon, 05 Jan 2026 23:51:17 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-29f3018dfc3so1264425ad.0 for ; Mon, 05 Jan 2026 15:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1767657075; cv=none; d=google.com; s=arc-20240605; b=TKSJSjZHc4oi93iJHCqmyrnerbDEdDCZ5B9PnCLp+sl/i2ZCnODJ8y08aHkcKnEi/g k4ZrmuxU3bnmFTFpWigdGbLMMdzVxybgJlxPJ5IvcOKoyXstq36QIa+Bags2Kzl0v2QL o4sAAJ2GXlPbdZrILlWMoh50ym8XsjhmBfiUcBLXs9Jg6mj6tvWw/CyLRigWaOWddiHv Gsi2S+3oJTZ426XYNks6WOsYECqcP7rG3UU1L4Uc7toXUn9QhuqrMUfQhHW2iIXtMpSZ 8Jc2vStaCXWbOk+3RdJuZqhxrDfRRZcuhAOFXw8j7UX7sobFHfGrS5al3i9tnNt2PzC1 oB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=UQF5V6Q0uW1YZ9p6W7aU9mzxnCYdLLNqbVRxUF5EaPA=; fh=msZ7vH1mbfja6+/WmutU4aZKNzdKO1jR7OxAI2TbZtI=; b=d0n+tjiDnS1lJ3ioIrxTmOO4hrBMmlih87J3sQiH2I4jbjt/qtOemw++LAmNBZZF7Y RCv2IbTau7Npb0oJMkMvjgtPk0paYOvTg13AsJKIowGHJECJoOauCor+x1aRwo24u051 TYkWij1O2k5w+C+mXYctEx0+HIPWI6SQjt3R0N6Iri0jv5rIPyILAR/lZwvCQt8K8bRE 6MYuhYGj4T/GhDqCftmXW5TXvHnmb8KPqE9/kG5wyA8lQIxXRRa4Nd0myjcv54qPSD9A C1wylfmM02PLN8d3XuNhJkzoiKg7K6zq7wjVm0+j/qDzn9uDAN4P4eKPwmPmCfSFWnN5 V+Ag==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767657075; x=1768261875; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=UQF5V6Q0uW1YZ9p6W7aU9mzxnCYdLLNqbVRxUF5EaPA=; b=ST0+wo5Je8dfIiGsS9IA1tJCreONOiqg6FxNZziOyC+En2fbeASBmyKVOzCGEF352f ekgcvp2Je5GOSXziQhGlnfuyrCRxjbnfISamqZ7B71jTSz9xNeGeKC4SMoTdLdML9sl0 oVFOJ+SnHbOqn4y7Q+CKRiwB5aIasJ6foSvW4O979gc1OLUcJVR6cyDrWUFS9/pNWX1Z nEStWkPBUBvwTv4cPt6tLB/0bBfKfowuRfaLWJHuOAM1+LClRsYswPcJBSVRvmiRQ7tu wyYGPqZAT6idErojrgIAdq6GHIKr1QLzsuSS8cFyOrgiBwhEfpe1Y1lsttPL50PzQ/PS uRVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767657075; x=1768261875; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UQF5V6Q0uW1YZ9p6W7aU9mzxnCYdLLNqbVRxUF5EaPA=; b=KQopJTt//5ugHM3rtgck3PdTgA9F4cFUGt3/cYiGwM6N8dF9Jf0d+GCnV16sgpA/VP zdNsTIO8jsRWY/o8WP6s/Wke2u9vFgTFquX355//XUjez0ebtakABWBfWP7vsiLvdeEk iybyaa3GHr/LnRgYf1TWLrc/mfVhNdX9FiHnqrg6RtgDQJiIgP9zcNmaEK/Jp7jJsuKo zdIBfbl0KFexZYtDnDkBczAqBMuXO2OtEHd1ZsXqhbfI/WcafEECCUDI34mCbtElGL7B lC+E7usb4Y7y5nOWNM74GmFFq5mg9bhd2OwM38nYIJH7Gw088Goe6nJemXxFlNvJb2/V vobw== X-Gm-Message-State: AOJu0YxQkxRkHkcFyP/RURxflvE+U6IYmImX4BuyzlaFq5aknTZ0tsNJ gXgaqLcNXTUWBjK2QgGCdyON1wwZB4ZybmPKzgQjRBftIFhlQcU5dTKAmxWipp7CK51MdKnhUCN T1j/67SXo99O/sbIMKHNwPM7uoQhYZaqiFw== X-Gm-Gg: AY/fxX4TkmvCBE0mOy0OOBKUcpNouC3BVEUxFyXRC2pd9uBJC2IQ6f9cAicz0AanU+B UQMLzFjmcwOPGEoktVVB8VbijzjGLsBLCeDZJnhh8BRgQj4Qz7mI6xUq35xRDPEzIcvQY5t4HVC x/6LxjDvhv0SX+zZzyai0IuDznrE0sJ8FgJAUyl+8eQeDOokY9oSs79YDr3J16NgjWQ/PEEcpe8 NSkK9wJaA9jHMDzOc2B/jaaKI3OxWtR/iTBLU8lPtnpYa3V5X583eOic3+BJfwzntS8Bwf+Z9Qe 2txv6U6Kuwku3bbmitIWgF7/39MuZu6P8HJilAMBcE97ErbrmW4eu25UupHvxeg= X-Google-Smtp-Source: AGHT+IFkbf4ffkdIcjo3W+CK9E79Eew1SwTnCaw+6yDo3u7HO5FGRds45bNgdgh7ElZm386+t0J3xLBcctoNQgHwcZw= X-Received: by 2002:a05:7301:6509:b0:2b0:2e6:5363 with SMTP id 5a478bee46e88-2b16f84e2eamr432778eec.1.1767657075126; Mon, 05 Jan 2026 15:51:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Thomas Munro Date: Tue, 6 Jan 2026 12:50:38 +1300 X-Gm-Features: AQt7F2qrzVaQF8jm12D8_vH_i7Pa4aGeLaBS8f5sJY9XLT8jcOMDYosv9WUP83Q Message-ID: Subject: Re: LLVM 22 To: Matheus Alcantara Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jan 6, 2026 at 10:56=E2=80=AFAM Matheus Alcantara wrote: > On Fri Jan 2, 2026 at 11:02 PM -03, Thomas Munro wrote: > > Intrinsic has incorrect argument type! > > ptr @llvm.lifetime.end.p0 > > Intrinsic has incorrect argument type! > > ptr @llvm.lifetime.end.p0 > > 2026-01-02 17:28:31.394 NZDT client backend[42798] pg_regress/boolean > > FATAL: fatal llvm error: Broken module found, compilation aborted! > > > I've managed to reproduce this using LLVM 22. Thanks for testing! > > Here's a potential minimal fix. I haven't yet proven that the > > optimisation is still working as expected. Probably need to compile > > an expression that calls an inlined function and then a non-inlined > > function with jit_dump_bitcode=3Dtrue, then find the right XXX.bc file > > under pgdata, llvm-dis XXX.bc, llc XXX.ll, then visually inspect XXX.s > > with enough caffeine to confirm that it's not spilling something (ie > > store instructions) where previously it didn't, but I wanted to post > > what I had so far to see if anyone has a better idea or an easy way to > > test it... > > > I'm not super familiar with reading assembly code but I tried my best to > inspect the LLVM 22 and LLVM 21 outputs and if I understood correctly I > think that 0002 is working as expected. Cool. And as another sanity test, if you comment out the new poison code so that we don't try to prevent unwanted spills/stores, can you see any? > I've noticed a reduction on some instructions when using LLVM 22 with > the 0002 patch compared with LLVM 21. For example, here we needed less > instructions to set up the registers: > > LLVM 22: > LBB2_8: ; %b.op.1.start > mov x20, #40824 ; =3D0x9f78 > movk x20, #19456, lsl #16 > movk x20, #1, lsl #32 > ldr x8, [x23] > ldrb w9, [x24] > str x8, [x20, #152] > strb w9, [x20, #160] > > LLVM 21: > LBB2_8: ; %b.op.1.start > mov x25, #25352 ; =3D0x6308 > movk x25, #2946, lsl #16 > movk x25, #1, lsl #32 > mov x20, #23533 ; =3D0x5bed > movk x20, #2946, lsl #16 > movk x20, #1, lsl #32 > ldr x8, [x23] > ldrb w9, [x24] > stur x8, [x25, #-248] > sturb w9, [x25, #-240] > > I've also noticed that the generated assembly code for LLVM 22 use the > str and strb instructions instead of stur and sturb in some cases, which > according to IA is an improvement but unfortunately I did not find any > reference to prove this, sorry. Interesting.