Skip to content

Commit 0f47dd4

Browse files
authored
Merge pull request #64 from grimaz/main
llvm-20 update
2 parents 8df7040 + 790e4b3 commit 0f47dd4

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

lifter/CustomPasses.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "llvm/IR/PassManager.h"
99
#include <llvm/Analysis/ValueTracking.h>
1010
#include <llvm/IR/CFG.h>
11+
#include <llvm/IR/Module.h>
1112
#include <llvm/IR/Function.h>
1213
#include <llvm/IR/Instructions.h>
1314
#include <llvm/Support/KnownBits.h>

lifter/GEPTracker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace BinaryOperations {
5757
bool readMemory(uint64_t addr, unsigned byteSize, APInt& value) {
5858

5959
uint64_t mappedAddr = address_to_mapped_address(addr);
60-
uint64_t tempValue;
60+
uint64_t tempValue = 0;
6161
if (mappedAddr > 0) {
6262
std::memcpy(&tempValue,
6363
reinterpret_cast<const void*>(data_g + mappedAddr), byteSize);

lifter/OperandUtils.ipp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ static void findAffectedValues(Value* Cond, SmallVectorImpl<Value*>& Affected) {
6262
}
6363
};
6464

65-
llvm::ICmpInst::Predicate Pred;
65+
llvm::ICmpInst::Predicate Pred = {};
6666
Value* A;
67-
68-
if (match(Cond, m_ICmp(Pred, m_Value(A), m_Constant()))) {
67+
#if LLVM_VERSION_MAJOR > 18
68+
llvm::CmpPredicate CmpPred { Pred };
69+
if (match(Cond, m_ICmp(CmpPred, m_Value(A), m_Constant()))) {
70+
#else
71+
if (match(Cond, m_ICmp(Pred, m_Value(A), m_Constant()))) {
72+
#endif
6973
AddAffected(A);
7074

7175
if (llvm::ICmpInst::isEquality(Pred)) {
@@ -625,11 +629,19 @@ KnownBits computeKnownBitsFromOperation(KnownBits& vv1, KnownBits& vv2,
625629

626630
switch (opcode) {
627631
case Instruction::Add: {
628-
return KnownBits::computeForAddSub(1, 0, vv1, vv2);
632+
#if LLVM_VERSION_MAJOR > 18
633+
return KnownBits::computeForAddSub(true, false, false, vv1, vv2);
634+
#else
635+
return KnownBits::computeForAddSub(true, false, vv1, vv2);
636+
#endif
629637
break;
630638
}
631639
case Instruction::Sub: {
632-
return KnownBits::computeForAddSub(0, 0, vv1, vv2);
640+
#if LLVM_VERSION_MAJOR > 18
641+
return KnownBits::computeForAddSub(false, false, false, vv1, vv2);
642+
#else
643+
return KnownBits::computeForAddSub(false, false, vv1, vv2);
644+
#endif
633645
break;
634646
}
635647
case Instruction::Mul: {

lifter/PathSolver.ipp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "lifterClass.hpp"
55
#include <llvm/IR/Function.h>
66
#include <llvm/IR/Value.h>
7+
#include <llvm/IR/Module.h>
8+
79

810
MERGEN_LIFTER_DEFINITION_TEMPLATES(PATH_info)::solvePath(
911
llvm::Function* function, uint64_t& dest, Value* simplifyValue) {
@@ -125,4 +127,4 @@ MERGEN_LIFTER_DEFINITION_TEMPLATES(PATH_info)::solvePath(
125127
}
126128

127129
return result;
128-
}
130+
}

0 commit comments

Comments
 (0)