From e32ae5ae50165593b82cffb6e946532618000933 Mon Sep 17 00:00:00 2001 From: Julian Büning Date: Wed, 17 Jul 2019 22:42:12 +0200 Subject: support compilation against LLVM 9.0 --- lib/Module/IntrinsicCleaner.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib/Module/IntrinsicCleaner.cpp') diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index 921e6766..1c30d781 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -264,14 +264,19 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { case Intrinsic::trap: { // Intrinsic instruction "llvm.trap" found. Directly lower it to // a call of the abort() function. - Function *F = cast( - M.getOrInsertFunction("abort", Type::getVoidTy(ctx) - KLEE_LLVM_GOIF_TERMINATOR)); - F->setDoesNotReturn(); - F->setDoesNotThrow(); + auto C = M.getOrInsertFunction("abort", Type::getVoidTy(ctx) + KLEE_LLVM_GOIF_TERMINATOR); +#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0) + if (auto *F = dyn_cast(C.getCallee())) { +#else + if (auto *F = dyn_cast(C)) { +#endif + F->setDoesNotReturn(); + F->setDoesNotThrow(); + } llvm::IRBuilder<> Builder(ii); - Builder.CreateCall(F); + Builder.CreateCall(C); Builder.CreateUnreachable(); i = ii->eraseFromParent(); -- cgit 1.4.1