From 634a41b48892f21b29d972e86f67b267c5ce865b Mon Sep 17 00:00:00 2001 From: Walter Date: Fri, 17 Jul 2026 14:22:21 +1000 Subject: [PATCH] LLVM 21 compatible `computeKnownFPClass` The signature for `computeKnownFPClass` changed with LLVM 21, so this commit includes a conditional compilation which is compatible. --- rpcs3/Emu/CPU/CPUTranslator.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rpcs3/Emu/CPU/CPUTranslator.h b/rpcs3/Emu/CPU/CPUTranslator.h index d7fb02633e..46b7a6836e 100644 --- a/rpcs3/Emu/CPU/CPUTranslator.h +++ b/rpcs3/Emu/CPU/CPUTranslator.h @@ -30,6 +30,7 @@ #if LLVM_VERSION_MAJOR >= 21 #include "llvm/Support/KnownFPClass.h" #endif +#include "llvm/Analysis/SimplifyQuery.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Analysis/ValueTracking.h" #include "llvm/IR/IntrinsicsX86.h" @@ -4286,7 +4287,13 @@ template llvm::KnownFPClass get_known_fp_class(T a, llvm::FPClassTest interested_classes) { static_assert(depth <= llvm::MaxAnalysisRecursionDepth, "Depth parameter can only decrease search. Default is max."); + +#if LLVM_MAJOR_VERSION >= 21 + const llvm::SimplifyQuery SQ(m_module->getDataLayout()); + return llvm::computeKnownFPClass(a.eval(m_ir), interested_classes, SQ, llvm::MaxAnalysisRecursionDepth - depth); +#else return llvm::computeKnownFPClass(a.eval(m_ir), m_module->getDataLayout(), interested_classes, llvm::MaxAnalysisRecursionDepth - depth); +#endif } private: