about summary refs log tree commit diff homepage
path: root/lib/Module/KModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module/KModule.cpp')
-rw-r--r--lib/Module/KModule.cpp56
1 files changed, 8 insertions, 48 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp
index 57e0c4fe..1334b58c 100644
--- a/lib/Module/KModule.cpp
+++ b/lib/Module/KModule.cpp
@@ -10,6 +10,7 @@
 // FIXME: This does not belong here.
 #include "../Core/Common.h"
 
+#define DEBUG_TYPE "KModule"
 #include "klee/Internal/Module/KModule.h"
 
 #include "Passes.h"
@@ -42,8 +43,13 @@
 
 #endif
 
-#include "llvm/PassManager.h"
+#if LLVM_VERSION_CODE < LLVM_VERSION(3, 5)
 #include "llvm/Support/CallSite.h"
+#else
+#include "llvm/IR/CallSite.h"
+#endif
+
+#include "llvm/PassManager.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/raw_os_ostream.h"
@@ -51,7 +57,6 @@
 #include "llvm/Transforms/Scalar.h"
 
 #include <llvm/Transforms/Utils/Cloning.h>
-#include <llvm/Support/InstIterator.h>
 
 #include <sstream>
 
@@ -224,56 +229,11 @@ static void forceImport(Module *m, const char *name, LLVM_TYPE_Q Type *retType,
 }
 #endif
 
-/// This function will take try to inline all calls to \p functionName
-/// in the module \p module .
-///
-/// It is intended that this function be used for inling calls to
-/// check functions like <tt>klee_div_zero_check()</tt>
-static void inlineChecks(Module *module, const char * functionName) {
-  std::vector<CallSite> checkCalls;
-    Function* runtimeCheckCall = module->getFunction(functionName);
-    if (runtimeCheckCall == 0)
-    {
-      KLEE_DEBUG(klee_warning("Failed to inline %s because no calls were made "
-                              "to it in module", functionName));
-      return;
-    }
-
-    for (Value::use_iterator i = runtimeCheckCall->use_begin(),
-        e = runtimeCheckCall->use_end(); i != e; ++i)
-      if (isa<InvokeInst>(*i) || isa<CallInst>(*i)) {
-        CallSite cs(*i);
-        if (!cs.getCalledFunction())
-          continue;
-        checkCalls.push_back(cs);
-      }
-
-    unsigned int successCount=0;
-    unsigned int failCount=0;
-    InlineFunctionInfo IFI(0,0);
-    for ( std::vector<CallSite>::iterator ci = checkCalls.begin(),
-          cie = checkCalls.end();
-          ci != cie; ++ci)
-    {
-      // Try to inline the function
-      if (InlineFunction(*ci,IFI))
-        ++successCount;
-      else
-      {
-        ++failCount;
-        klee_warning("Failed to inline function %s", functionName);
-      }
-    }
-
-    KLEE_DEBUG(klee_message("Tried to inline calls to %s. %u successes, "
-                            "%u failures", functionName, successCount,
-                            failCount));
-}
 
 void KModule::addInternalFunction(const char* functionName){
   Function* internalFunction = module->getFunction(functionName);
   if (!internalFunction) {
-    KLEE_DEBUG_WITH_TYPE("KModule", klee_warning(
+    KLEE_DEBUG(klee_warning(
         "Failed to add internal function %s. Not found.", functionName));
     return ;
   }