about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2018-06-15 07:57:23 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-07-12 23:25:49 +0100
commitf7a20a1e0266f79c81e1ccc3b9d5b556748d7657 (patch)
tree00a78e59f3337f703225f1c8434d44830d9b4ccc /lib
parent7ff20e3da8b6d3384157d24282d510eb8e4d2f10 (diff)
downloadklee-f7a20a1e0266f79c81e1ccc3b9d5b556748d7657.tar.gz
llvm38: handle optimization passes changes
createFunctionAttrsPass was split to createPostOrderFunctionAttrsPass
and createReversePostOrderFunctionAttrsPass in LLVM commit e96fb9ab15d4.

createGlobalsModRefPass was changed to createGlobalsAAWrapperPass in
LLVM commit 9146833fa313.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Module/Optimize.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp
index 18c56cc2..c788ee36 100644
--- a/lib/Module/Optimize.cpp
+++ b/lib/Module/Optimize.cpp
@@ -35,6 +35,10 @@
 #include "llvm/Analysis/Verifier.h"
 #endif
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+#include "llvm/Analysis/GlobalsModRef.h"
+#endif
+
 using namespace llvm;
 
 // Don't verify at the end
@@ -102,7 +106,12 @@ static void AddStandardCompilePasses(klee::LegacyLLVMPassManagerTy &PM) {
   addPass(PM, createCFGSimplificationPass());    // Clean up after IPCP & DAE
 
   addPass(PM, createPruneEHPass());              // Remove dead EH info
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+  addPass(PM, createPostOrderFunctionAttrsPass());
+  addPass(PM, createReversePostOrderFunctionAttrsPass()); // Deduce function attrs
+#else
   addPass(PM, createFunctionAttrsPass());        // Deduce function attrs
+#endif
 
   if (!DisableInline)
     addPass(PM, createFunctionInliningPass());   // Inline small functions
@@ -216,8 +225,14 @@ void Optimize(Module *M, llvm::ArrayRef<const char *> preservedFunctions) {
     addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
 
     // Run a few AA driven optimizations here and now, to cleanup the code.
+#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
+    addPass(Passes, createPostOrderFunctionAttrsPass());
+    addPass(Passes, createReversePostOrderFunctionAttrsPass()); // Add nocapture
+    addPass(Passes, createGlobalsAAWrapperPass());   // IP alias analysis
+#else
     addPass(Passes, createFunctionAttrsPass());      // Add nocapture
     addPass(Passes, createGlobalsModRefPass());      // IP alias analysis
+#endif
 
     addPass(Passes, createLICMPass());               // Hoist loop invariants
     addPass(Passes, createGVNPass());                // Remove redundancies