about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yaml12
-rw-r--r--CMakeLists.txt14
-rw-r--r--cmake/workaround_llvm_pr39177.cmake133
-rw-r--r--cmake/workaround_llvm_pr39177.ll18
-rw-r--r--include/klee/Config/config.h.cmin3
-rw-r--r--include/klee/Support/Casting.h7
-rw-r--r--include/klee/Support/ModuleUtil.h20
-rw-r--r--lib/Core/Executor.cpp38
-rw-r--r--lib/Core/ExternalDispatcher.cpp10
-rw-r--r--lib/Core/StatsTracker.cpp17
-rw-r--r--lib/Module/CMakeLists.txt4
-rw-r--r--lib/Module/IntrinsicCleaner.cpp12
-rw-r--r--lib/Module/KModule.cpp22
-rw-r--r--lib/Module/ModuleUtil.cpp16
-rw-r--r--lib/Module/Optimize.cpp14
-rw-r--r--lib/Module/Passes.h12
-rw-r--r--lib/Module/RaiseAsm.cpp4
-rw-r--r--lib/Module/WorkaroundLLVMPR39177.cpp92
-rw-r--r--lib/Solver/SolverCmdLine.cpp5
-rw-r--r--lib/Support/CompressionStream.cpp5
-rw-r--r--lib/Support/FileHandling.cpp6
-rw-r--r--scripts/build/p-clang-linux-ubuntu.inc6
-rw-r--r--scripts/build/p-clang-linux.inc10
-rw-r--r--scripts/build/p-klee.inc3
-rw-r--r--scripts/build/p-llvm-linux-ubuntu.inc20
-rw-r--r--scripts/build/p-sanitizer-linux-ubuntu.inc6
-rw-r--r--scripts/build/p-sanitizer-linux.inc8
-rw-r--r--scripts/build/patches/llvm60.patch13
-rw-r--r--scripts/build/patches/llvm70.patch13
-rw-r--r--scripts/build/patches/llvm80.patch12
-rw-r--r--test/Feature/FNeg.ll1
-rw-r--r--test/Intrinsics/IsConstant.ll1
-rw-r--r--test/Intrinsics/Saturating.ll1
-rw-r--r--test/Intrinsics/fshlr.ll1
-rw-r--r--test/Intrinsics/objectsize.leq80.ll40
-rw-r--r--test/Intrinsics/objectsize.ll1
-rw-r--r--test/lit.cfg2
-rw-r--r--tools/klee/main.cpp8
38 files changed, 23 insertions, 587 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 0dfd0891..8448d6b0 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -40,9 +40,6 @@ jobs:
                 "LLVM 11, Doxygen",
                 "LLVM 10",
                 "LLVM 9",
-                "LLVM 8",
-                "LLVM 7",
-                "LLVM 6",
                 "ASan",
                 "UBSan",
                 "MSan",
@@ -70,15 +67,6 @@ jobs:
           - name: "LLVM 9"
             env:
               LLVM_VERSION: 9
-          - name: "LLVM 8"
-            env:
-              LLVM_VERSION: 8
-          - name: "LLVM 7"
-            env:
-              LLVM_VERSION: 7
-          - name: "LLVM 6"
-            env:
-              LLVM_VERSION: "6.0"
           # Sanitizer builds. Do unoptimized build otherwise the optimizer might remove problematic code
           - name: "ASan"
             env:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16e33ea9..89054a86 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -455,11 +455,6 @@ else()
 endif()
 
 ################################################################################
-# Workarounds
-################################################################################
-include(${CMAKE_SOURCE_DIR}/cmake/workaround_llvm_pr39177.cmake)
-
-################################################################################
 # KLEE runtime support
 ################################################################################
 # This is set here and not in `runtime` because `config.h` needs to be generated.
@@ -612,13 +607,8 @@ if (ENABLE_KLEE_EH_CXX)
   endif()
   message(STATUS "Use libc++abi source path: \"${KLEE_LIBCXXABI_SRC_DIR}\"")
 
-  if (${LLVM_VERSION_MAJOR} GREATER 8 OR ${LLVM_VERSION_MAJOR} EQUAL 8)
-    set(SUPPORT_KLEE_EH_CXX 1) # For config.h
-    message(STATUS "Support for C++ Exceptions enabled")
-  else()
-    set(SUPPORT_KLEE_EH_CXX 0) # For config.h
-    message(STATUS "Support for C++ Exceptions (only available for LLVM >= 8.0.0) disabled")
-  endif()
+  set(SUPPORT_KLEE_EH_CXX 1) # For config.h
+  message(STATUS "Support for C++ Exceptions enabled")
 
 else()
   set(SUPPORT_KLEE_EH_CXX 0) # For config.h
diff --git a/cmake/workaround_llvm_pr39177.cmake b/cmake/workaround_llvm_pr39177.cmake
deleted file mode 100644
index 9e0ac8bd..00000000
--- a/cmake/workaround_llvm_pr39177.cmake
+++ /dev/null
@@ -1,133 +0,0 @@
-# Workaround for LLVM PR39177
-#  - https://bugs.llvm.org/show_bug.cgi?id=39177
-#  - https://github.com/klee/klee/issues/1000
-#
-# TODO: remove when support for LLVM <= 7 is dropped
-#
-# Short description of the bug:
-# The LLVM pass `-instcombine` optimizes calls to C standard lib functions by,
-# e.g. transforming the following call to a call to fwrite():
-#   fprintf(stderr, "hello world!\n");
-# In uClibc, and thus klee-uclibc, fwrite() is defined as an alias to a function
-# fwrite_unlocked(). This translates to a GlobalAlias in LLVM IR. When trying to
-# infer function attributes from fwrite(), LLVM tries to cast a GlobalAlias to a
-# Function, which results in a null-pointer dereference. When calling KLEE with
-# `-optimize`, this leads to a crash of KLEE.
-#
-# This bug affects LLVM 3.9 - 7.0.0.
-#
-# As the bug results in a null-pointer dereference when trying to access a
-# Function that is only available as GlobalAlias, this workaround introduces a
-# pass into KLEE that replaces aliases for certain C standard lib function with
-# clones of the corresponding aliasee function.
-#
-# The bug was fixed in the following commits in LLVM:
-#  - https://reviews.llvm.org/rL344454
-#  - https://reviews.llvm.org/rL344455
-#  - https://reviews.llvm.org/rL344645
-# These patches were then applied to the release_70 branch to land in 7.0.1:
-#  - https://reviews.llvm.org/rL345921
-#
-# This CMake file checks whether the method responsible for the null-pointer
-# dereference leads to a crash of the program given in this file.
-#
-# Files that were created/modified for this workaround:
-# [NEW FILE] cmake/workaround_llvm_pr39177.cmake (this file)
-# [NEW FILE] cmake/workaround_llvm_pr39177.ll (auxiliary file for feature test)
-# [NEW FILE] lib/Module/WorkaroundLLVMPR39177.cpp
-#
-# [MODIFIED] CMakeLists.txt (including this file)
-# [MODIFIED] include/klee/Config/config.h.cmin (cmakedefine)
-# [MODIFIED] lib/Module/CMakeLists.txt
-# [MODIFIED] lib/Module/Optimize.cpp (add pass during optimization)
-# [MODIFIED] lib/Module/Passes.h
-
-# Detect whether LLVM version is affected by PR39177
-if (${LLVM_VERSION_MAJOR} LESS 7 OR (${LLVM_VERSION_MAJOR} EQUAL 7 AND ${LLVM_VERSION_MINOR} EQUAL 0 AND ${LLVM_VERSION_PATCH} EQUAL 0)) # LLVM <= 7.0.0
-  set(DISABLE_WORKAROUND_LLVM_PR39177_DEFAULT OFF)
-else()
-  set(DISABLE_WORKAROUND_LLVM_PR39177_DEFAULT ON)
-endif()
-
-option(DISABLE_WORKAROUND_LLVM_PR39177 "Disable Workaround for LLVM PR39177 (affecting LLVM 3.9 - 7.0.0)" ${DISABLE_WORKAROUND_LLVM_PR39177_DEFAULT})
-
-if (NOT DISABLE_WORKAROUND_LLVM_PR39177)
-  # Detect whether PR39177 leads to crash
-  include(CheckCXXSourceRuns)
-
-  cmake_push_check_state()
-  klee_get_llvm_libs(LLVM_LIBS asmparser transformutils)
-  set(CMAKE_REQUIRED_INCLUDES "${LLVM_INCLUDE_DIRS}")
-  set(CMAKE_REQUIRED_LIBRARIES "${LLVM_LIBS}")
-
-  check_cxx_source_runs("
-    #include \"llvm/Analysis/TargetLibraryInfo.h\"
-    #include \"llvm/AsmParser/Parser.h\"
-    #include \"llvm/AsmParser/SlotMapping.h\"
-    #include \"llvm/IR/ConstantFolder.h\"
-    #include \"llvm/IR/Constants.h\"
-    #include \"llvm/IR/DataLayout.h\"
-    #include \"llvm/IR/DiagnosticInfo.h\"
-    #include \"llvm/IR/Instructions.h\"
-    #include \"llvm/IR/IRBuilder.h\"
-    #include \"llvm/IR/LLVMContext.h\"
-    #include \"llvm/Transforms/Utils/BuildLibCalls.h\"
-
-    #include <signal.h>
-
-    void handler(int, siginfo_t*, void*) {
-      // program received SIGSEGV
-      exit(1);
-    }
-
-    using namespace llvm;
-
-    int main() {
-      // capture segfault
-      struct sigaction action;
-      memset(&action, 0, sizeof(struct sigaction));
-      action.sa_flags = SA_SIGINFO;
-      action.sa_sigaction = handler;
-      sigaction(SIGSEGV, &action, NULL);
-
-      // setup test
-      LLVMContext Ctx;
-      SMDiagnostic Error;
-      SlotMapping Mapping;
-      auto M = llvm::parseAssemblyFile(\"${CMAKE_SOURCE_DIR}/cmake/workaround_llvm_pr39177.ll\", Error, Ctx, &Mapping);
-      if (!M) {
-        Error.print(\"AssemblyString\", llvm::errs());
-        return -1;
-      }
-
-      auto *F = M->getFunction(\"test\");
-      auto *CI = cast<CallInst>(&*std::next(F->begin()->begin()));
-      auto &DL = M->getDataLayout();
-      Value *Size = ConstantInt::get(DL.getIntPtrType(Ctx), 8);
-      ConstantFolder CF;
-      IRBuilder<> B(&*F->begin(), CF);
-      TargetLibraryInfo TLI = TargetLibraryInfoWrapperPass({\"x86_64\", \"\", \"linux-gnu\"}).getTLI();
-
-      // test if this call produces segfault
-      emitFWrite(CI->getArgOperand(1), Size, CI->getArgOperand(0), B, DL, &TLI);
-
-      return 0;
-    }"
-    LLVM_PR39177_FIXED
-  )
-  cmake_pop_check_state()
-
-  if (NOT LLVM_PR39177_FIXED)
-    message(STATUS "Workaround for LLVM PR39177 (affecting LLVM 3.9 - 7.0.0) enabled")
-    set(USE_WORKAROUND_LLVM_PR39177 1) # For config.h
-  else()
-    message(FATAL_ERROR "DISABLE_WORKAROUND_LLVM_PR39177 is not set to true"
-      "but crash resulting from PR39177 could not be detected."
-      "You may try to disable the workaround using"
-      "-DDISABLE_WORKAROUND_LLVM_PR39177=1 if you believe the issue is patched"
-      "in your version of LLVM.")
-  endif()
-else()
-  message(STATUS "Workaround for LLVM PR39177 (affecting LLVM 3.9 - 7.0.0) disabled")
-  unset(USE_WORKAROUND_LLVM_PR39177) # For config.h
-endif()
diff --git a/cmake/workaround_llvm_pr39177.ll b/cmake/workaround_llvm_pr39177.ll
deleted file mode 100644
index ebca4f1c..00000000
--- a/cmake/workaround_llvm_pr39177.ll
+++ /dev/null
@@ -1,18 +0,0 @@
-%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
-%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
-
-@stdout = external global %struct._IO_FILE*, align 8
-@.str = private unnamed_addr constant [11 x i8] c"abcdefgh!\0A\00", align 1
-@fwrite = alias i64 (i8*, i64, i64, %struct._IO_FILE*), i64 (i8*, i64, i64, %struct._IO_FILE*)* @__fwrite_alias
-
-define i64 @__fwrite_alias(i8*, i64, i64, %struct._IO_FILE*) {
-  ret i64 0
-}
-
-define void @test() {
-  %1 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8
-  %2 = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0))
-  ret void
-}
-
-declare i32 @fprintf(%struct._IO_FILE*, i8*, ...)
diff --git a/include/klee/Config/config.h.cmin b/include/klee/Config/config.h.cmin
index b9fdf7c3..24dc87e8 100644
--- a/include/klee/Config/config.h.cmin
+++ b/include/klee/Config/config.h.cmin
@@ -86,9 +86,6 @@
 /* Define to the version of this package. */
 #cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@
 
-/* Use Workaround for LLVM PR39177 (affecting LLVM 3.9 - 7.0.0) */
-#cmakedefine USE_WORKAROUND_LLVM_PR39177 @USE_WORKAROUND_LLVM_PR39177@
-
 /* libcxx is supported */
 #cmakedefine SUPPORT_KLEE_LIBCXX @SUPPORT_KLEE_LIBCXX@
 
diff --git a/include/klee/Support/Casting.h b/include/klee/Support/Casting.h
index 865218a0..5b04380e 100644
--- a/include/klee/Support/Casting.h
+++ b/include/klee/Support/Casting.h
@@ -21,14 +21,7 @@ using llvm::cast_or_null;
 using llvm::dyn_cast;
 using llvm::dyn_cast_or_null;
 using llvm::isa;
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
 using llvm::isa_and_nonnull;
-#else
-template <typename... X, typename Y>
-inline bool isa_and_nonnull(const Y &value) {
-  return value && isa<X...>(value);
-}
-#endif
 
 } // namespace klee
 
diff --git a/include/klee/Support/ModuleUtil.h b/include/klee/Support/ModuleUtil.h
index 40c58f4e..328b9aeb 100644
--- a/include/klee/Support/ModuleUtil.h
+++ b/include/klee/Support/ModuleUtil.h
@@ -12,11 +12,7 @@
 
 #include "klee/Config/Version.h"
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
 #include "llvm/IR/InstrTypes.h"
-#else
-#include "llvm/IR/CallSite.h"
-#endif
 #include "llvm/IR/Module.h"
 
 #include <memory>
@@ -44,17 +40,11 @@ linkModules(std::vector<std::unique_ptr<llvm::Module>> &modules,
 /// calls, although complicated constant expressions might be
 /// another possibility).
 ///
-/// If `moduleIsFullyLinked` is set to true it will be assumed that the
-///  module containing the `llvm::CallSite` (`llvm::CallBase` on LLVM 8+)
-///  is fully linked. This assumption allows resolution of functions
-///  that are marked as overridable.
-llvm::Function *getDirectCallTarget(
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
-    const llvm::CallBase &cb,
-#else
-    const llvm::CallSite &cs,
-#endif
-    bool moduleIsFullyLinked);
+/// If `moduleIsFullyLinked` is set to true it will be assumed that the module
+/// containing the `llvm::CallBase` is fully linked. This assumption allows
+/// resolution of functions that are marked as overridable.
+llvm::Function *getDirectCallTarget(const llvm::CallBase &cb,
+                                    bool moduleIsFullyLinked);
 
 /// Return true iff the given Function value is used in something
 /// other than a direct call (or a constant expression that
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index a2928864..529f8b43 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -56,9 +56,6 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/BasicBlock.h"
-#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0)
-#include "llvm/IR/CallSite.h"
-#endif
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
@@ -1782,7 +1779,6 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f,
     }
 #endif
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
     case Intrinsic::fshr:
     case Intrinsic::fshl: {
       ref<Expr> op1 = eval(ki, 1, state).value;
@@ -1807,7 +1803,6 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f,
       }
       break;
     }
-#endif
 
     // va_arg is handled by caller and intrinsic lowering, see comment for
     // ExecutionState::varargs
@@ -1928,21 +1923,10 @@ void Executor::executeCall(ExecutionState &state, KInstruction *ki, Function *f,
       uint64_t offsets[callingArgs]; // offsets of variadic arguments
       uint64_t argWidth;             // width of current variadic argument
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
       const CallBase &cs = cast<CallBase>(*i);
-#else
-      const CallSite cs(i);
-#endif
       for (unsigned k = funcArgs; k < callingArgs; k++) {
         if (cs.isByValArgument(k)) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
           Type *t = cs.getParamByValType(k);
-#else
-          auto arg = cs.getArgOperand(k);
-          Type *t = arg->getType();
-          assert(t->isPointerTy());
-          t = t->getPointerElementType();
-#endif
           argWidth = kmodule->targetData->getTypeSizeInBits(t);
         } else {
           argWidth = arguments[k]->getWidth();
@@ -2152,13 +2136,7 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
           Expr::Width to = getWidthForLLVMType(t);
             
           if (from != to) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
             const CallBase &cs = cast<CallBase>(*caller);
-#else
-            const CallSite cs(isa<InvokeInst>(caller)
-                                  ? CallSite(cast<InvokeInst>(caller))
-                                  : CallSite(cast<CallInst>(caller)));
-#endif
 
             // XXX need to check other param attrs ?
             bool isSExt = cs.hasRetAttr(llvm::Attribute::SExt);
@@ -2416,14 +2394,8 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
     if (isa<DbgInfoIntrinsic>(i))
       break;
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
     const CallBase &cs = cast<CallBase>(*i);
     Value *fp = cs.getCalledOperand();
-#else
-    const CallSite cs(i);
-    Value *fp = cs.getCalledValue();
-#endif
-
     unsigned numArgs = cs.arg_size();
     Function *f = getTargetFunction(fp, state);
 
@@ -2830,8 +2802,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
   }
 
     // Floating point instructions
-
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
   case Instruction::FNeg: {
     ref<ConstantExpr> arg =
         toConstant(state, eval(ki, 0, state).value, "floating point");
@@ -2843,7 +2813,6 @@ void Executor::executeInstruction(ExecutionState &state, KInstruction *ki) {
     bindLocal(ki, state, ConstantExpr::alloc(Res.bitcastToAPInt()));
     break;
   }
-#endif
 
   case Instruction::FAdd: {
     ref<ConstantExpr> left = toConstant(state, eval(ki, 0, state).value,
@@ -4643,14 +4612,7 @@ size_t Executor::getAllocationAlignment(const llvm::Value *allocSite) const {
     type = AI->getAllocatedType();
   } else if (isa<InvokeInst>(allocSite) || isa<CallInst>(allocSite)) {
     // FIXME: Model the semantics of the call to use the right alignment
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
     const CallBase &cs = cast<CallBase>(*allocSite);
-#else
-    llvm::Value *allocSiteNonConst = const_cast<llvm::Value *>(allocSite);
-    const CallSite cs(isa<InvokeInst>(allocSiteNonConst)
-                          ? CallSite(cast<InvokeInst>(allocSiteNonConst))
-                          : CallSite(cast<CallInst>(allocSiteNonConst)));
-#endif
     llvm::Function *fn =
         klee::getDirectCallTarget(cs, /*moduleIsFullyLinked=*/true);
     if (fn)
diff --git a/lib/Core/ExternalDispatcher.cpp b/lib/Core/ExternalDispatcher.cpp
index aadb340d..c58e2ec8 100644
--- a/lib/Core/ExternalDispatcher.cpp
+++ b/lib/Core/ExternalDispatcher.cpp
@@ -10,9 +10,6 @@
 #include "ExternalDispatcher.h"
 #include "klee/Config/Version.h"
 
-#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0)
-#include "llvm/IR/CallSite.h"
-#endif
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/IRBuilder.h"
@@ -258,14 +255,7 @@ Function *ExternalDispatcherImpl::createDispatcher(Function *target,
   if (!resolveSymbol(target->getName().str()))
     return 0;
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
   const CallBase &cs = cast<CallBase>(*inst);
-#else
-  const CallSite cs(inst->getOpcode() == Instruction::Call
-                        ? CallSite(cast<CallInst>(inst))
-                        : CallSite(cast<InvokeInst>(inst)));
-#endif
-
   Value **args = new Value *[cs.arg_size()];
 
   std::vector<Type *> nullary;
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index 28c52b7f..11199db1 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -29,9 +29,6 @@
 
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/IR/BasicBlock.h"
-#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0)
-#include "llvm/IR/CallSite.h"
-#endif
 #include "llvm/IR/CFG.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/InlineAsm.h"
@@ -139,13 +136,8 @@ static bool instructionIsCoverable(Instruction *i) {
     } else {
       Instruction *prev = &*(--it);
       if (isa<CallInst>(prev) || isa<InvokeInst>(prev)) {
-        Function *target = getDirectCallTarget(
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
-            cast<CallBase>(*prev),
-#else
-            CallSite(prev),
-#endif
-            /*moduleIsFullyLinked=*/true);
+        Function *target = getDirectCallTarget(cast<CallBase>(*prev),
+                                               /*moduleIsFullyLinked=*/true);
         if (target && target->doesNotReturn())
           return false;
       }
@@ -794,13 +786,8 @@ void StatsTracker::computeReachableUncovered() {
              it != ie; ++it) {
           Instruction *inst = &*it;
           if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
             const CallBase &cs = cast<CallBase>(*inst);
             if (isa<InlineAsm>(cs.getCalledOperand())) {
-#else
-            const CallSite cs(inst);
-            if (isa<InlineAsm>(cs.getCalledValue())) {
-#endif
               // We can never call through here so assume no targets
               // (which should be correct anyhow).
               callTargets.insert(std::make_pair(inst,
diff --git a/lib/Module/CMakeLists.txt b/lib/Module/CMakeLists.txt
index f78575fb..6c2a24b3 100644
--- a/lib/Module/CMakeLists.txt
+++ b/lib/Module/CMakeLists.txt
@@ -22,10 +22,6 @@ set(KLEE_MODULE_COMPONENT_SRCS
   RaiseAsm.cpp
 )
 
-if (USE_WORKAROUND_LLVM_PR39177)
-  list(APPEND KLEE_MODULE_COMPONENT_SRCS WorkaroundLLVMPR39177.cpp)
-endif()
-
 klee_add_component(kleeModule
   ${KLEE_MODULE_COMPONENT_SRCS}
 )
diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp
index adef513e..bdaca425 100644
--- a/lib/Module/IntrinsicCleaner.cpp
+++ b/lib/Module/IntrinsicCleaner.cpp
@@ -68,10 +68,8 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
       case Intrinsic::fabs:
       case Intrinsic::fma:
       case Intrinsic::fmuladd:
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
       case Intrinsic::fshr:
       case Intrinsic::fshl:
-#endif
 #if LLVM_VERSION_CODE >= LLVM_VERSION(12, 0)
       case Intrinsic::abs:
       case Intrinsic::smax:
@@ -216,7 +214,6 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
         dirty = true;
         break;
       }
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
       case Intrinsic::sadd_sat:
       case Intrinsic::ssub_sat:
       case Intrinsic::uadd_sat:
@@ -284,17 +281,12 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
         dirty = true;
         break;
       }
-#endif
 
       case Intrinsic::trap: {
         // Intrinsic instruction "llvm.trap" found. Directly lower it to
         // a call of the abort() function.
         auto C = M.getOrInsertFunction("abort", Type::getVoidTy(ctx));
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
         if (auto *F = dyn_cast<Function>(C.getCallee())) {
-#else
-        if (auto *F = dyn_cast<Function>(C)) {
-#endif
           F->setDoesNotReturn();
           F->setDoesNotThrow();
         }
@@ -326,7 +318,6 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
         dirty = true;
         break;
       }
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
       case Intrinsic::is_constant: {
         if(auto* constant = llvm::ConstantFoldInstruction(ii, ii->getModule()->getDataLayout()))
           ii->replaceAllUsesWith(constant);
@@ -336,7 +327,6 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
         dirty = true;
         break;
       }
-#endif
 
       // The following intrinsics are currently handled by LowerIntrinsicCall
       // (Invoking LowerIntrinsicCall with any intrinsics not on this
@@ -352,9 +342,7 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) {
       case Intrinsic::ctpop:
       case Intrinsic::cttz:
       case Intrinsic::dbg_declare:
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
       case Intrinsic::dbg_label:
-#endif
 #ifndef SUPPORT_KLEE_EH_CXX
       case Intrinsic::eh_typeid_for:
 #endif
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 139149e5..049c6744 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -23,9 +23,6 @@
 #include "klee/Support/ModuleUtil.h"
 
 #include "llvm/Bitcode/BitcodeWriter.h"
-#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0)
-#include "llvm/IR/CallSite.h"
-#endif
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Instructions.h"
@@ -40,13 +37,9 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/raw_os_ostream.h"
 #include "llvm/Transforms/Scalar.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
 #include "llvm/Transforms/Scalar/Scalarizer.h"
-#endif
 #include "llvm/Transforms/Utils/Cloning.h"
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
 #include "llvm/Transforms/Utils.h"
-#endif
 
 #include <sstream>
 
@@ -138,14 +131,8 @@ static Function *getStubFunctionForCtorList(Module *m,
     for (unsigned i=0; i<arr->getNumOperands(); i++) {
       auto cs = cast<ConstantStruct>(arr->getOperand(i));
       // There is a third element in global_ctor elements (``i8 @data``).
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
       assert(cs->getNumOperands() == 3 &&
              "unexpected element in ctor initializer list");
-#else
-      // before LLVM 9.0, the third operand was optional
-      assert((cs->getNumOperands() == 2 || cs->getNumOperands() == 3) &&
-             "unexpected element in ctor initializer list");
-#endif
       auto fp = cs->getOperand(1);
       if (!fp->isNullValue()) {
         if (auto ce = dyn_cast<llvm::ConstantExpr>(fp))
@@ -303,11 +290,7 @@ void KModule::manifest(InterpreterHandler *ih, bool forceSourceOutput) {
 
   if (OutputModule) {
     std::unique_ptr<llvm::raw_fd_ostream> f(ih->openOutputFile("final.bc"));
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
     WriteBitcodeToFile(*module, *f);
-#else
-    WriteBitcodeToFile(module.get(), *f);
-#endif
   }
 
   /* Build shadow structures */
@@ -468,13 +451,8 @@ KFunction::KFunction(llvm::Function *_function,
       ki->dest = registerMap[inst];
 
       if (isa<CallInst>(it) || isa<InvokeInst>(it)) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
         const CallBase &cs = cast<CallBase>(*inst);
         Value *val = cs.getCalledOperand();
-#else
-        const CallSite cs(inst);
-        Value *val = cs.getCalledValue();
-#endif
         unsigned numArgs = cs.arg_size();
         ki->operands = new int[numArgs+1];
         ki->operands[0] = getOperandNum(val, registerMap, km, ki);
diff --git a/lib/Module/ModuleUtil.cpp b/lib/Module/ModuleUtil.cpp
index 87a9c917..e1c6e8bd 100644
--- a/lib/Module/ModuleUtil.cpp
+++ b/lib/Module/ModuleUtil.cpp
@@ -270,17 +270,9 @@ klee::linkModules(std::vector<std::unique_ptr<llvm::Module>> &modules,
 }
 
 Function *klee::getDirectCallTarget(
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
     const CallBase &cs,
-#else
-    const CallSite &cs,
-#endif
     bool moduleIsFullyLinked) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
   Value *v = cs.getCalledOperand();
-#else
-  Value *v = cs.getCalledValue();
-#endif
   bool viaConstantExpr = false;
   // Walk through aliases and bitcasts to try to find
   // the function being called.
@@ -318,16 +310,10 @@ Function *klee::getDirectCallTarget(
 
 static bool valueIsOnlyCalled(const Value *v) {
   for (auto user : v->users()) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
     // Make sure the instruction is a call or invoke.
     if (const auto *cs_ptr = dyn_cast<CallBase>(user)) {
       const CallBase &cs = *cs_ptr;
-#else
-    if (const auto *instr = dyn_cast<Instruction>(user)) {
-      // Make sure the instruction is a call or invoke.
-      const CallSite cs(const_cast<Instruction *>(instr));
-      if (!cs) return false;
-#endif
+
       // Make sure that the value is only the target of this call and
       // not an argument.
       if (cs.hasArgument(v))
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index a58d2459..c982b73d 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -18,10 +18,6 @@
 #include "klee/Config/Version.h"
 #include "klee/Support/OptionCategories.h"
 
-#ifdef USE_WORKAROUND_LLVM_PR39177
-#include "Passes.h"
-#endif
-
 #include "llvm/Analysis/GlobalsModRef.h"
 #include "llvm/Analysis/Passes.h"
 #include "llvm/Analysis/LoopPass.h"
@@ -33,15 +29,13 @@
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/PluginLoader.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/IPO/FunctionAttrs.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Scalar/GVN.h"
-
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
 #include "llvm/Transforms/Utils.h"
-#include "llvm/Transforms/InstCombine/InstCombine.h"
-#endif
+
 
 using namespace llvm;
 
@@ -167,10 +161,6 @@ void Optimize(Module *M, llvm::ArrayRef<const char *> preservedFunctions) {
   if (VerifyEach)
     Passes.add(createVerifierPass());
 
-#ifdef USE_WORKAROUND_LLVM_PR39177
-  addPass(Passes, new klee::WorkaroundLLVMPR39177Pass());
-#endif
-
   // DWD - Run the opt standard pass list as well.
   AddStandardCompilePasses(Passes);
 
diff --git a/lib/Module/Passes.h b/lib/Module/Passes.h
index ae1ce6fd..3eb43ec3 100644
--- a/lib/Module/Passes.h
+++ b/lib/Module/Passes.h
@@ -185,18 +185,6 @@ private:
 
 };
 
-#ifdef USE_WORKAROUND_LLVM_PR39177
-/// WorkaroundLLVMPR39177Pass - Workaround for LLVM PR39177 within KLEE repo.
-/// For more information on this, please refer to the comments in
-/// cmake/workaround_llvm_pr39177.cmake
-class WorkaroundLLVMPR39177Pass : public llvm::ModulePass {
-public:
-  static char ID;
-  WorkaroundLLVMPR39177Pass() : llvm::ModulePass(ID) {}
-  bool runOnModule(llvm::Module &M) override;
-};
-#endif
-
 /// Instruments every function that contains a KLEE function call as nonopt
 class OptNonePass : public llvm::ModulePass {
 public:
diff --git a/lib/Module/RaiseAsm.cpp b/lib/Module/RaiseAsm.cpp
index 248b4344..98e580a8 100644
--- a/lib/Module/RaiseAsm.cpp
+++ b/lib/Module/RaiseAsm.cpp
@@ -42,11 +42,7 @@ bool RaiseAsmPass::runOnInstruction(Module &M, Instruction *I) {
   if (!ci)
     return false;
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
   InlineAsm *ia = dyn_cast<InlineAsm>(ci->getCalledOperand());
-#else
-  InlineAsm *ia = dyn_cast<InlineAsm>(ci->getCalledValue());
-#endif
   if (!ia)
     return false;
 
diff --git a/lib/Module/WorkaroundLLVMPR39177.cpp b/lib/Module/WorkaroundLLVMPR39177.cpp
deleted file mode 100644
index 92458847..00000000
--- a/lib/Module/WorkaroundLLVMPR39177.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-//===-- WorkaroundLLVMPR39177.cpp -------------------------------*- C++ -*-===//
-//
-//                     The KLEE Symbolic Virtual Machine
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-// This pass provides a workaround for LLVM bug PR39177 within the KLEE repo.
-// For more information on this, please refer to the comments in
-// cmake/workaround_llvm_pr39177.cmake
-
-#include "Passes.h"
-#include "klee/Support/ErrorHandling.h"
-
-#include "llvm/Transforms/Utils/Cloning.h"
-
-using namespace llvm;
-
-namespace klee {
-
-bool WorkaroundLLVMPR39177Pass::runOnModule(Module &M) {
-  bool modified = false;
-
-  const char *libfunctions[] = {
-    "strlen",
-    "strchr",
-    "strncmp",
-    "strcpy",
-    "strncpy",
-    "__memcpy_chk",
-    "memchr",
-    "memcmp",
-    "putchar",
-    "puts",
-    "fputc",
-    "fputc_unlocked",
-    "fputs",
-    "fputs_unlocked",
-    "fwrite",
-    "malloc",
-    "calloc",
-    "fwrite_unlocked",
-    "fgetc_unlocked",
-    "fgets_unlocked",
-    "fread_unlocked",
-    "memset_pattern16",
-    "fopen"
-  };
-
-  for (auto *funcname : libfunctions) {
-    if (M.getFunction(funcname) != nullptr)
-      continue;
-
-    GlobalValue *gv = M.getNamedValue(funcname);
-    auto *alias = dyn_cast_or_null<GlobalAlias>(gv);
-    if (alias == nullptr)
-      continue;
-
-    // get aliasee function if exists
-    while (auto *ga = dyn_cast<GlobalAlias>(alias->getAliasee())) {
-      assert(ga != alias && "alias pointing to itself");
-      alias = ga;
-    }
-    Function *f = dyn_cast<Function>(alias->getAliasee());
-    if (f == nullptr)
-      continue;
-
-    std::string aliasName = alias->getName().str();
-
-    // clone function
-    ValueToValueMapTy VMap;
-    Function *g = CloneFunction(f, VMap);
-
-    // replace alias with cloned function
-    alias->replaceAllUsesWith(g);
-    g->takeName(alias);
-    alias->eraseFromParent();
-
-    klee_message(
-        "WorkaroundLLVMPR39177: replaced alias @%s with clone of function @%s",
-        aliasName.c_str(), f->getName().str().c_str());
-    modified = true;
-  }
-
-  return modified;
-}
-
-char WorkaroundLLVMPR39177Pass::ID = 0;
-
-} // namespace klee
diff --git a/lib/Solver/SolverCmdLine.cpp b/lib/Solver/SolverCmdLine.cpp
index d91261dc..b0bff6e6 100644
--- a/lib/Solver/SolverCmdLine.cpp
+++ b/lib/Solver/SolverCmdLine.cpp
@@ -117,12 +117,7 @@ void KCommandLine::HideOptions(llvm::cl::OptionCategory &Category) {
   StringMap<cl::Option *> &map = cl::getRegisteredOptions();
 
   for (auto &elem : map) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
     for (auto &cat : elem.second->Categories) {
-#else
-    {
-      auto &cat = elem.second->Category;
-#endif
       if (cat == &Category) {
         elem.second->setHiddenFlag(cl::Hidden);
       }
diff --git a/lib/Support/CompressionStream.cpp b/lib/Support/CompressionStream.cpp
index 95dbe006..3dc50558 100644
--- a/lib/Support/CompressionStream.cpp
+++ b/lib/Support/CompressionStream.cpp
@@ -26,13 +26,8 @@ compressed_fd_ostream::compressed_fd_ostream(const std::string &Filename,
     : llvm::raw_ostream(), pos(0) {
   ErrorInfo = "";
   // Open file in binary mode
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
   std::error_code EC =
       llvm::sys::fs::openFileForWrite(Filename, FD);
-#else
-  std::error_code EC =
-      llvm::sys::fs::openFileForWrite(Filename, FD, llvm::sys::fs::F_None);
-#endif
   if (EC) {
     ErrorInfo = EC.message();
     FD = -1;
diff --git a/lib/Support/FileHandling.cpp b/lib/Support/FileHandling.cpp
index 46205521..8658f462 100644
--- a/lib/Support/FileHandling.cpp
+++ b/lib/Support/FileHandling.cpp
@@ -25,14 +25,8 @@ klee_open_output_file(const std::string &path, std::string &error) {
   error.clear();
   std::error_code ec;
 
-#if LLVM_VERSION_CODE >= LLVM_VERSION(7, 0)
   auto f = std::make_unique<llvm::raw_fd_ostream>(path.c_str(), ec,
                                                   llvm::sys::fs::OF_None);
-#else
-  auto f = std::make_unique<llvm::raw_fd_ostream>(path.c_str(), ec,
-                                                  llvm::sys::fs::F_None);
-#endif
-
   if (ec)
     error = ec.message();
   if (!error.empty()) {
diff --git a/scripts/build/p-clang-linux-ubuntu.inc b/scripts/build/p-clang-linux-ubuntu.inc
index 9dac1352..286246ca 100644
--- a/scripts/build/p-clang-linux-ubuntu.inc
+++ b/scripts/build/p-clang-linux-ubuntu.inc
@@ -1,10 +1,6 @@
 install_binary_artifact_clang() {
   local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-
-  local version=""
-  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"
+  local version="-${LLVM_VERSION_MAJOR}"
 
   source "${DIR}/common-functions"
 
diff --git a/scripts/build/p-clang-linux.inc b/scripts/build/p-clang-linux.inc
index 25f468fa..6481fdd8 100644
--- a/scripts/build/p-clang-linux.inc
+++ b/scripts/build/p-clang-linux.inc
@@ -1,9 +1,6 @@
 setup_artifact_variables_clang() {
   local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-  local version=""
-  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"
+  local version="-${LLVM_VERSION_MAJOR}"
 
   # Only set LLVM_CONFIG if not set yet
   if [[ -z "${LLVM_CONFIG:-}" ]]; then
@@ -21,10 +18,7 @@ setup_artifact_variables_clang() {
 # Check if the binary artifact is installed
 is_installed_clang() {
   local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-  local version=""
-  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"
+  local version="${LLVM_VERSION_MAJOR}"
 
   # Check if clang with the right version exists
   which "clang-${version}"
diff --git a/scripts/build/p-klee.inc b/scripts/build/p-klee.inc
index 1c7d39a5..a69f654a 100644
--- a/scripts/build/p-klee.inc
+++ b/scripts/build/p-klee.inc
@@ -52,9 +52,6 @@ if [ "${USE_LIBCXX}" -eq 1 ]; then
     "-DENABLE_KLEE_LIBCXX=TRUE"
     "-DKLEE_LIBCXX_DIR=${LIBCXX_INSTALL}"
     "-DKLEE_LIBCXX_INCLUDE_DIR=${LIBCXX_INSTALL}/include/c++/v1"
-  )
-  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 8 ]] && CMAKE_ARGUMENTS+=(
     "-DENABLE_KLEE_EH_CXX=TRUE"
     "-DKLEE_LIBCXXABI_SRC_DIR=${LIBCXX_SRC}/libcxxabi"
   )
diff --git a/scripts/build/p-llvm-linux-ubuntu.inc b/scripts/build/p-llvm-linux-ubuntu.inc
index 421fe8cd..48a0083f 100644
--- a/scripts/build/p-llvm-linux-ubuntu.inc
+++ b/scripts/build/p-llvm-linux-ubuntu.inc
@@ -60,9 +60,7 @@ install_binary_artifact_llvm() {
   )
   with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
 
-  local version=""
-  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"
+  local version="-${LLVM_VERSION_MAJOR}"
 
   # Add LLVM upstream repository if available
   codename="$(lsb_release --codename --short)"
@@ -105,12 +103,8 @@ check_llvm_config_version() {
       [[ -z "${lc}" ]] && return 1
     fi
 
-    local version=""
     local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-    local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-    [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
-    [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"
-
+    local version="${LLVM_VERSION_MAJOR}"
 
     # Check for llvm-config without suffix but correct version number
     [[ $($lc --version) == "${LLVM_VERSION}"* ]] || return 1
@@ -136,11 +130,8 @@ check_llvm_config_version() {
 # Check if the binary artifact is installed
 is_installed_llvm() {
   # Check for variables set and not empty
-  local version=""
   local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
-  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"
+  local version="${LLVM_VERSION_MAJOR}"
 
   # Check for llvm-config without suffix but correct version number
   local lc
@@ -158,11 +149,8 @@ is_installed_llvm() {
 
 setup_artifact_variables_llvm() {
     # Check for variables set and not empty
-    local version=""
     local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
-    local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
-    [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
-    [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"
+    local version="${LLVM_VERSION_MAJOR}"
 
     local lc=""
     # Check for llvm-config without suffix but correct version number
diff --git a/scripts/build/p-sanitizer-linux-ubuntu.inc b/scripts/build/p-sanitizer-linux-ubuntu.inc
index bb6187ea..30e153bb 100644
--- a/scripts/build/p-sanitizer-linux-ubuntu.inc
+++ b/scripts/build/p-sanitizer-linux-ubuntu.inc
@@ -5,11 +5,7 @@ install_binary_artifact_sanitizer() {
 
   source "${DIR}/common-functions"
   local SANITIZER_LLVM_VERSION_MAJOR="${SANITIZER_LLVM_VERSION/.*/}"
-  local SANITIZER_LLVM_VERSION_MINOR="${SANITIZER_LLVM_VERSION/*./}"
-
-  local version=""
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${SANITIZER_LLVM_VERSION}"
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${SANITIZER_LLVM_VERSION_MAJOR}"
+  local version="-${SANITIZER_LLVM_VERSION_MAJOR}"
 
   # Add certificate
   with_sudo apt update -y
diff --git a/scripts/build/p-sanitizer-linux.inc b/scripts/build/p-sanitizer-linux.inc
index b7a7718e..fa9f35f3 100644
--- a/scripts/build/p-sanitizer-linux.inc
+++ b/scripts/build/p-sanitizer-linux.inc
@@ -1,9 +1,7 @@
 setup_artifact_variables_sanitizer() {
   local SANITIZER_LLVM_VERSION_MAJOR="${SANITIZER_LLVM_VERSION/.*/}"
   local SANITIZER_LLVM_VERSION_MINOR="${SANITIZER_LLVM_VERSION/*./}"
-  local version=""
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${SANITIZER_LLVM_VERSION}"
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${SANITIZER_LLVM_VERSION_MAJOR}"
+  local version="-${SANITIZER_LLVM_VERSION_MAJOR}"
 
   # Only set LLVM_CONFIG if not set yet
   if [[ -z "${SANITIZER_LLVM_CONFIG-}" ]]; then
@@ -33,9 +31,7 @@ is_installed_sanitizer() {
   fi
   local SANITIZER_LLVM_VERSION_MAJOR="${SANITIZER_LLVM_VERSION/.*/}"
   local SANITIZER_LLVM_VERSION_MINOR="${SANITIZER_LLVM_VERSION/*./}"
-  local version=""
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -le 6 ]] && version="${SANITIZER_LLVM_VERSION}"
-  [[ "${SANITIZER_LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${SANITIZER_LLVM_VERSION_MAJOR}"
+  local version=="${SANITIZER_LLVM_VERSION_MAJOR}"
 
   # Check if clang with the right version exists
   which "clang-${version}"
diff --git a/scripts/build/patches/llvm60.patch b/scripts/build/patches/llvm60.patch
deleted file mode 100644
index 6a9f7eb7..00000000
--- a/scripts/build/patches/llvm60.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/llvm/tools/llvm-shlib/CMakeLists.txt
-+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
-@@ -36,7 +36,10 @@ endif()
-
- add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
-
-+if(LIB_NAMES)
- list(REMOVE_DUPLICATES LIB_NAMES)
-+endif()
-+
- if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
-    OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
-    OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
\ No newline at end of file
diff --git a/scripts/build/patches/llvm70.patch b/scripts/build/patches/llvm70.patch
deleted file mode 100644
index bb6462b7..00000000
--- a/scripts/build/patches/llvm70.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/llvm/tools/llvm-shlib/CMakeLists.txt
-+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
-@@ -36,7 +36,10 @@ endif()
-
- add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
-
-+if(LIB_NAMES)
- list(REMOVE_DUPLICATES LIB_NAMES)
-+endif()
-+
- if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
-    OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
-    OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
\ No newline at end of file
diff --git a/scripts/build/patches/llvm80.patch b/scripts/build/patches/llvm80.patch
deleted file mode 100644
index dcc9f78c..00000000
--- a/scripts/build/patches/llvm80.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/llvm/tools/llvm-shlib/CMakeLists.txt
-+++ b/llvm/tools/llvm-shlib/CMakeLists.txt
-@@ -41,7 +41,9 @@ if(LLVM_BUILD_LLVM_DYLIB)
-
-   add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
-
-+  if(LIB_NAMES)
-   list(REMOVE_DUPLICATES LIB_NAMES)
-+  endif()
-   if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU)
-      OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
-      OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "GNU")
\ No newline at end of file
diff --git a/test/Feature/FNeg.ll b/test/Feature/FNeg.ll
index cdea6aaa..a6213fc2 100644
--- a/test/Feature/FNeg.ll
+++ b/test/Feature/FNeg.ll
@@ -1,4 +1,3 @@
-; REQUIRES: geq-llvm-8.0
 ; RUN: %llvmas %s -o %t.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee -exit-on-error -output-dir=%t.klee-out -optimize=false %t.bc
diff --git a/test/Intrinsics/IsConstant.ll b/test/Intrinsics/IsConstant.ll
index b196d933..72ab5e72 100644
--- a/test/Intrinsics/IsConstant.ll
+++ b/test/Intrinsics/IsConstant.ll
@@ -1,4 +1,3 @@
-; REQUIRES: geq-llvm-8.0
 ; RUN: %llvmas %s -o=%t.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee -exit-on-error --output-dir=%t.klee-out --optimize=false %t.bc
diff --git a/test/Intrinsics/Saturating.ll b/test/Intrinsics/Saturating.ll
index 15aad409..306ec93b 100644
--- a/test/Intrinsics/Saturating.ll
+++ b/test/Intrinsics/Saturating.ll
@@ -1,4 +1,3 @@
-; REQUIRES: geq-llvm-8.0
 ; RUN: %llvmas %s -f -o %t1.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee --output-dir=%t.klee-out --optimize=false %t1.bc | FileCheck %s
diff --git a/test/Intrinsics/fshlr.ll b/test/Intrinsics/fshlr.ll
index fcdf32ff..a47951f3 100644
--- a/test/Intrinsics/fshlr.ll
+++ b/test/Intrinsics/fshlr.ll
@@ -14,7 +14,6 @@
 ; where the constants a, b, c and r are copied from the constants
 ; used in the LLVM testfile llvm/test/Analysis/ConstantFolding/funnel-shift.ll
 
-; REQUIRES: geq-llvm-7.0
 ; RUN: %llvmas %s -o=%t.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee -exit-on-error --output-dir=%t.klee-out --optimize=false %t.bc
diff --git a/test/Intrinsics/objectsize.leq80.ll b/test/Intrinsics/objectsize.leq80.ll
deleted file mode 100644
index ce2a2429..00000000
--- a/test/Intrinsics/objectsize.leq80.ll
+++ /dev/null
@@ -1,40 +0,0 @@
-; REQUIRES: lt-llvm-9.0
-; RUN: %llvmas %s -o=%t.bc
-; RUN: rm -rf %t.klee-out
-; RUN: %klee -exit-on-error --output-dir=%t.klee-out --optimize=false %t.bc
-; ModuleID = 'objectsize.c'
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @main() nounwind uwtable {
-entry:
-  %a = alloca i8*, align 8
-  %0 = load i8*, i8** %a, align 8
-  %1 = call i64 @llvm.objectsize.i64.p0i8(i8* %0, i1 true, i1 false)
-  %cmp = icmp ne i64 %1, 0
-  br i1 %cmp, label %abort.block, label %continue.block
-
-continue.block:
-  %2 = load i8*, i8** %a, align 8
-  %3 = call i64 @llvm.objectsize.i64.p0i8(i8* %2, i1 false, i1 false)
-  %cmp1 = icmp ne i64 %3, -1
-  br i1 %cmp1, label %abort.block, label %continue.block2
-
-continue.block2:
-; allocate one byte
-  %b = alloca i8, align 8
-  %4 = call i64 @llvm.objectsize.i64.p0i8(i8* %b, i1 false, i1 false)
-  %cmp2 = icmp ne i64 %4, 1
-  br i1 %cmp2, label %abort.block, label %exit.block
-
-exit.block:
-  ret i32 0
-
-abort.block:
-  call void @abort()
-  unreachable
-}
-
-declare i64 @llvm.objectsize.i64.p0i8(i8*, i1, i1) nounwind readnone
-
-declare void @abort() noreturn nounwind
diff --git a/test/Intrinsics/objectsize.ll b/test/Intrinsics/objectsize.ll
index 9fa84de5..f5d6a51a 100644
--- a/test/Intrinsics/objectsize.ll
+++ b/test/Intrinsics/objectsize.ll
@@ -1,5 +1,4 @@
 ; LLVM 9 added parameter "dynamic" to @llvm.objectsize
-; REQUIRES: geq-llvm-9.0
 ; RUN: %llvmas %s -o=%t.bc
 ; RUN: rm -rf %t.klee-out
 ; RUN: %klee -exit-on-error --output-dir=%t.klee-out --optimize=false %t.bc
diff --git a/test/lit.cfg b/test/lit.cfg
index 84ad0c79..4d7382cf 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -161,7 +161,7 @@ config.substitutions.append(
 
 # Add feature for the LLVM version in use, so it can be tested in REQUIRES and
 # XFAIL checks. We also add "not-XXX" variants, for the same reason.
-known_llvm_versions = { "6.0", "7.0", "7.1", "8.0", "9.0", "10.0", "11.0", "11.1", "12.0", "13.0" }
+known_llvm_versions = { "9.0", "10.0", "11.0", "11.1", "12.0", "13.0" }
 current_llvm_version_tuple = (int(config.llvm_version_major), int(config.llvm_version_minor))
 current_llvm_version = "%s.%s" % current_llvm_version_tuple
 
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 3b0731c8..8dc2fd27 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -914,11 +914,7 @@ void externalsAndGlobalsCheck(const llvm::Module *m) {
       for (BasicBlock::const_iterator it = bbIt->begin(), ie = bbIt->end();
            it != ie; ++it) {
         if (const CallInst *ci = dyn_cast<CallInst>(it)) {
-#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0)
           if (isa<InlineAsm>(ci->getCalledOperand())) {
-#else
-          if (isa<InlineAsm>(ci->getCalledValue())) {
-#endif
             klee_warning_once(&*fnIt,
                               "function \"%s\" has inline asm",
                               fnIt->getName().data());
@@ -1088,11 +1084,7 @@ createLibCWrapper(std::vector<std::unique_ptr<llvm::Module>> &modules,
 
   std::vector<llvm::Value*> args;
   args.push_back(llvm::ConstantExpr::getBitCast(
-#if LLVM_VERSION_CODE >= LLVM_VERSION(9, 0)
       cast<llvm::Constant>(inModuleReference.getCallee()),
-#else
-      inModuleReference,
-#endif
       ft->getParamType(0)));
   args.push_back(&*(stub->arg_begin())); // argc
   auto arg_it = stub->arg_begin();