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 1vlEp0-0099wn-0R for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Jan 2026 23:19:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vlEoz-004Ttg-0H for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Jan 2026 23:19:37 +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 1vlEoy-004TtE-08 for pgsql-hackers@lists.postgresql.org; Wed, 28 Jan 2026 23:19:37 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vlEov-002or0-1U for pgsql-hackers@lists.postgresql.org; Wed, 28 Jan 2026 23:19:35 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id EEF75EC0011; Wed, 28 Jan 2026 18:19:32 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 28 Jan 2026 18:19:32 -0500 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=fm3; t=1769642372; x=1769728772; bh=vM2hUakJGK LfpAx0CPbmveJM8eVvdcddI2AvV5/3dH4=; b=l8yLcWY5Bc4AOfXkGB5XxkU1yb EoM9nRGAytaKa96JCIIAXkzosGN8g5aoamhZJpPNVo5YUc83LUpe1CPlV2ETkcuR vtIzLIUAtEvQS1ZJWGO0fZ5/chh/4qLtsmVn6rii0WhgBx6/fRKWGGjh6GJPUONf lVfIVWCVxdvk44Dce8RFEFOl7KXybb3TFzg1F0DxoOD6wnMTraRXOBmEHRumN2E0 yz4P8c5YzVv2hZvpIqpUvTe5OWQolWo1Tm4sMavNL0m+lwTmSYvz8geEAUQqugvX NqPqwZHoTH7vURUzIEL4kD2LshkD4VQ+Uruaow27f0zoaey0mN80cYqX4SFA== 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=fm3; t= 1769642372; x=1769728772; bh=vM2hUakJGKLfpAx0CPbmveJM8eVvdcddI2A vV5/3dH4=; b=WWtLN4tM/haT2T5ds3RLLbgTa0YBFGmySV2rdpmUpMVWacXpDnm L3qAdeavgmW7l+YqO1LmKAFDu2phu43/3KKscm0/rlnvTM5q4gwNGAeNEZ3FaBuG IRFkB3Dyw18K35yToAG5+huCBDAi6jd8O0CnG0CERnNGF3iXgehh1Spv0YME1wlw FVo62Fid6etsAbKSZHs462ewrLUdocwL/Acqw7eYziYlDS27OPHvlpVpTMQW4/lM WXayxGxUTZscPnIHIfG98qLfeOJMM5p+NIZbsJk3Dgj5Y1Z7t1BANHUbUeB7OdYy yIs8XItch33TS9eRdagIYPlmWYn67UvF8FA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduieegiedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvvefukfhfgggtuggjsehttdfstd dttddvnecuhfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgr rhgriigvlhdruggvqeenucggtffrrghtthgvrhhnpeeffffgledvffegtdevlefgtdeggf fhvdekgfegteeiveejkeetudelveejhfeugeenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghlrdguvgdpnh gspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgrthhh vghushhsshhilhhvleejsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhh grtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohep phdrphhsqhhlsehpihhnrghrrghfrdhinhhfoh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jan 2026 18:19:32 -0500 (EST) Date: Wed, 28 Jan 2026 18:19:32 -0500 From: Andres Freund To: Pierre Ducroquet Cc: Matheus Alcantara , "pgsql-hackers@lists.postgresql.org" Subject: Re: [PATCH] llvmjit: always add the simplifycfg pass Message-ID: References: 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-01-28 07:56:46 +0000, Pierre Ducroquet wrote: > Here is a rebased version of the patch with a rewrite of the comment. Thank > you again for your previous review. FYI, I've tried adding other passes but > none had a similar benefits over cost ratio. The benefits could rather be in > changing from O3 to an extensive list of passes. I agree that we should have a better list of passes. I'm a bit worried that having an explicit list of passes that we manage ourselves is going to be somewhat of a pain to maintain across llvm versions, but ... WRT passes that might be worth having even with -O0 - running duplicate function merging early on could be quite useful, particularly because we won't inline the deform routines anyway. > > I did some benchmarks on some TPCH queries (1 and 4) and I got these > > results. Note that for these tests I set jit_optimize_above_cost=1000000 > > so that it force to use the default pass with simplifycfg. FYI, you can use -1 to just disble it, instead of having to rely on a specific cost. > > > > Master Q1: > > Timing: Generation 1.553 ms (Deform 0.573 ms), Inlining 0.052 ms, Optimization 95.571 ms, Emission 58.941 ms, Total 156.116 ms > > Execution Time: 38221.318 ms > > > > Patch Q1: > > Timing: Generation 1.477 ms (Deform 0.534 ms), Inlining 0.040 ms, Optimization 95.364 ms, Emission 58.046 ms, Total 154.927 ms > > Execution Time: 38257.797 ms > > > > Master Q4: > > Timing: Generation 0.836 ms (Deform 0.309 ms), Inlining 0.086 ms, Optimization 5.098 ms, Emission 6.963 ms, Total 12.983 ms > > Execution Time: 19512.134 ms > > > > Patch Q4: > > Timing: Generation 0.802 ms (Deform 0.294 ms), Inlining 0.090 ms, Optimization 5.234 ms, Emission 6.521 ms, Total 12.648 ms > > Execution Time: 16051.483 ms > > > > > > For Q4 I see a small increase on Optimization phase but we have a good > > performance improvement on execution time. For Q1 the results are almost > > the same. These queries are all simple enough that I'm not sure this is a particularly good benchmark for optimization speed. In particular, the deform routines don't have to deal with a lot of columns and there aren't a lot of functions (although I guess that shouldn't really matter WRT simplifycfg). Greetings, Andres Freund