From 9b40521e050c52b5fa5baefbc64fc243d25431e8 Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Thu, 14 May 2026 19:53:23 +0200 Subject: [PATCH 1/2] Truncate int replacements --- lib/ConstValueConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ConstValueConstructor.cpp b/lib/ConstValueConstructor.cpp index 4588fc8..d0a3e60 100644 --- a/lib/ConstValueConstructor.cpp +++ b/lib/ConstValueConstructor.cpp @@ -28,6 +28,6 @@ llvm::Value *FloatingValueConstructor::constructValue(llvm::Type *type) { IntValueConstructor::IntValueConstructor(int value) : constantValue(value) {} llvm::Value *IntValueConstructor::constructValue(llvm::Type *type) { - llvm::APInt intValue(type->getIntegerBitWidth(), constantValue); + llvm::APInt intValue(type->getIntegerBitWidth(), constantValue, false, true); return llvm::ConstantInt::get(type, intValue); } From a1f01f0932b8514fc3511fafe56cf1986193719f Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Thu, 14 May 2026 20:29:42 +0200 Subject: [PATCH 2/2] versioning --- lib/ConstValueConstructor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ConstValueConstructor.cpp b/lib/ConstValueConstructor.cpp index d0a3e60..f5857f8 100644 --- a/lib/ConstValueConstructor.cpp +++ b/lib/ConstValueConstructor.cpp @@ -28,6 +28,10 @@ llvm::Value *FloatingValueConstructor::constructValue(llvm::Type *type) { IntValueConstructor::IntValueConstructor(int value) : constantValue(value) {} llvm::Value *IntValueConstructor::constructValue(llvm::Type *type) { +#if LLVM_VERSION_MAJOR >= 20 llvm::APInt intValue(type->getIntegerBitWidth(), constantValue, false, true); +#else + llvm::APInt intValue(type->getIntegerBitWidth(), constantValue); +#endif return llvm::ConstantInt::get(type, intValue); }