diff --git a/lib/IntrinsicReplacement.cpp b/lib/IntrinsicReplacement.cpp index 1b9c400..60bc10c 100644 --- a/lib/IntrinsicReplacement.cpp +++ b/lib/IntrinsicReplacement.cpp @@ -38,8 +38,13 @@ void IntrinsicReplacement::mutate(llvm::Instruction *instruction) { assert(instruction); assert(canMutate(instruction)); auto intrinsic = llvm::cast(instruction); +#if LLVM_VERSION_MAJOR >= 20 + auto replacement = llvm::Intrinsic::getOrInsertDeclaration( + instruction->getModule(), to, { intrinsic->getFunctionType()->getParamType(0) }); +#else auto replacement = llvm::Intrinsic::getDeclaration( instruction->getModule(), to, { intrinsic->getFunctionType()->getParamType(0) }); +#endif std::vector arguments; for (auto &arg : intrinsic->args()) { diff --git a/lib/NegateXORReplacement.cpp b/lib/NegateXORReplacement.cpp index bce0d1d..d750daa 100644 --- a/lib/NegateXORReplacement.cpp +++ b/lib/NegateXORReplacement.cpp @@ -46,7 +46,13 @@ void NegateXORReplacement::mutate(llvm::Instruction *instruction) { /// entry: /// %not = xor i1 false, true /// %xor = xor i1 true, %not + +#if LLVM_VERSION_MAJOR >= 20 + auto position = llvm::BasicBlock::iterator(instruction); +#else + auto position = instruction; +#endif auto rhs = instruction->getOperand(1); - auto notInstruction = llvm::BinaryOperator::CreateNot(rhs, "not", instruction); + auto notInstruction = llvm::BinaryOperator::CreateNot(rhs, "not", position); instruction->setOperand(1, notInstruction); }