From 35a4bbba600749aa4b7e00d40c154ba20fb0bd80 Mon Sep 17 00:00:00 2001 From: Alex March Date: Tue, 8 Sep 2026 14:25:55 +0900 Subject: [PATCH] llvm19: backport a fix for const analysis crash on fp128 --- ...lvm-007-constantfolding-null-tli-fp128.patch | 17 +++++++++++++++++ srcpkgs/llvm19/template | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/llvm19/patches/llvm-007-constantfolding-null-tli-fp128.patch diff --git a/srcpkgs/llvm19/patches/llvm-007-constantfolding-null-tli-fp128.patch b/srcpkgs/llvm19/patches/llvm-007-constantfolding-null-tli-fp128.patch new file mode 100644 index 00000000000000..3e9ec8ca4db77d --- /dev/null +++ b/srcpkgs/llvm19/patches/llvm-007-constantfolding-null-tli-fp128.patch @@ -0,0 +1,17 @@ +Backport of upstream commit 83a5c7cb62e404a713a35445b755cf0109650279 +"[ConstantFolding] Ensure TLI is valid when simplifying fp128 intrinsics" + +The inliner's cost analysis calls ConstantFoldCall without a TargetLibraryInfo. +When the host build has logf128, the fp128 folding path dereferences TLI and segfaults. + +--- a/llvm/lib/Analysis/ConstantFolding.cpp ++++ b/llvm/lib/Analysis/ConstantFolding.cpp +@@ -2124,7 +2124,7 @@ + } + + LibFunc Fp128Func = NotLibFunc; +- if (TLI->getLibFunc(Name, Fp128Func) && TLI->has(Fp128Func) && ++ if (TLI && TLI->getLibFunc(Name, Fp128Func) && TLI->has(Fp128Func) && + Fp128Func == LibFunc_logl) + return ConstantFoldFP128(logf128, Op->getValueAPF(), Ty); + } diff --git a/srcpkgs/llvm19/template b/srcpkgs/llvm19/template index 503b6e9dc52e5d..03080a1634c18e 100644 --- a/srcpkgs/llvm19/template +++ b/srcpkgs/llvm19/template @@ -1,7 +1,7 @@ # Template file for 'llvm19' pkgname=llvm19 version=19.1.4 -revision=8 +revision=9 build_wrksrc=llvm build_style=cmake _llvm_prefix=lib/llvm/19