about summary refs log tree commit diff homepage
path: root/lib/Module
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2023-10-30 14:56:27 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2024-02-08 13:17:19 +0000
commitc4f1634c29545a90fab75801593a529d7dfe0309 (patch)
treea8f53d1b0e796a6400bd99185a2edfb6dbcd7412 /lib/Module
parent01af1ca33400a075a953050ce80985eea47ee2b2 (diff)
downloadklee-c4f1634c29545a90fab75801593a529d7dfe0309.tar.gz
Disable unsupported passes for newer LLVM versions
Similar functionality needs to be added using a new pass manager
Diffstat (limited to 'lib/Module')
-rw-r--r--lib/Module/OptimizeLegacy.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Module/OptimizeLegacy.cpp b/lib/Module/OptimizeLegacy.cpp
index 53488924..20c8ac2a 100644
--- a/lib/Module/OptimizeLegacy.cpp
+++ b/lib/Module/OptimizeLegacy.cpp
@@ -98,14 +98,18 @@ static void AddStandardCompilePasses(legacy::PassManager &PM) {
   addPass(PM, createInstructionCombiningPass()); // Clean up after IPCP & DAE
   addPass(PM, createCFGSimplificationPass());    // Clean up after IPCP & DAE
 
+#if LLVM_VERSION_CODE <= LLVM_VERSION(15, 0)
   addPass(PM, createPruneEHPass()); // Remove dead EH info
+#endif
   addPass(PM, createPostOrderFunctionAttrsLegacyPass());
   addPass(PM,
           createReversePostOrderFunctionAttrsPass()); // Deduce function attrs
 
   if (!DisableInline)
     addPass(PM, createFunctionInliningPass()); // Inline small functions
-  addPass(PM, createArgumentPromotionPass());  // Scalarize uninlined fn args
+#if LLVM_VERSION_CODE <= LLVM_VERSION(14, 0)
+  addPass(PM, createArgumentPromotionPass()); // Scalarize uninlined fn args
+#endif
 
   addPass(PM, createInstructionCombiningPass()); // Cleanup for scalarrepl.
   addPass(PM, createJumpThreadingPass());        // Thread jumps.
@@ -118,7 +122,9 @@ static void AddStandardCompilePasses(legacy::PassManager &PM) {
   addPass(PM, createReassociatePass());         // Reassociate expressions
   addPass(PM, createLoopRotatePass());
   addPass(PM, createLICMPass());         // Hoist loop invariants
+#if LLVM_VERSION_CODE <= LLVM_VERSION(14, 0)
   addPass(PM, createLoopUnswitchPass()); // Unswitch loops.
+#endif
   // FIXME : Removing instcombine causes nestedloop regression.
   addPass(PM, createInstructionCombiningPass());
   addPass(PM, createIndVarSimplifyPass());       // Canonicalize indvars
@@ -197,13 +203,17 @@ void klee::optimizeModule(llvm::Module *M,
   if (!DisableInline)
     addPass(Passes, createFunctionInliningPass()); // Inline small functions
 
-  addPass(Passes, createPruneEHPass());         // Remove dead EH info
+#if LLVM_VERSION_CODE <= LLVM_VERSION(15, 0)
+  addPass(Passes, createPruneEHPass()); // Remove dead EH info
+#endif
   addPass(Passes, createGlobalOptimizerPass()); // Optimize globals again.
   addPass(Passes, createGlobalDCEPass());       // Remove dead functions
 
+#if LLVM_VERSION_CODE <= LLVM_VERSION(14, 0)
   // If we didn't decide to inline a function, check to see if we can
   // transform it to pass arguments by value instead of by reference.
   addPass(Passes, createArgumentPromotionPass());
+#endif
 
   // The IPO passes may leave cruft around.  Clean up after them.
   addPass(Passes, createInstructionCombiningPass());