LLVM 21 compatible computeKnownFPClass

The signature for `computeKnownFPClass` changed with LLVM 21, so this commit includes a conditional compilation which is compatible.
This commit is contained in:
Walter
2026-07-17 14:22:21 +10:00
committed by Elad
parent 53835b294e
commit 634a41b488
+7
View File
@@ -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 <typename T1, typename T2, typename T3>
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: