diff --git a/core/iwasm/compilation/aot_llvm_extra.cpp b/core/iwasm/compilation/aot_llvm_extra.cpp index 492cf3dcf..27a014d84 100644 --- a/core/iwasm/compilation/aot_llvm_extra.cpp +++ b/core/iwasm/compilation/aot_llvm_extra.cpp @@ -348,12 +348,16 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx, LLVMModuleRef module) FPM.addPass(LoadStoreVectorizerPass()); if (comp_ctx->enable_llvm_pgo || comp_ctx->use_prof_file) { - LICMOptions licm_opt; /* LICM pass: loop invariant code motion, attempting to remove as much code from the body of a loop as possible. Experiments show it is good to enable it when pgo is enabled. */ +#if LLVM_VERSION_MAJOR >= 15 + LICMOptions licm_opt; FPM.addPass( createFunctionToLoopPassAdaptor(LICMPass(licm_opt), true)); +#else + FPM.addPass(createFunctionToLoopPassAdaptor(LICMPass(), true)); +#endif } /* diff --git a/core/iwasm/compilation/aot_llvm_extra2.cpp b/core/iwasm/compilation/aot_llvm_extra2.cpp index 9bd44bbff..2d665c5f6 100644 --- a/core/iwasm/compilation/aot_llvm_extra2.cpp +++ b/core/iwasm/compilation/aot_llvm_extra2.cpp @@ -4,7 +4,11 @@ */ #include +#if LLVM_VERSION_MAJOR >= 14 #include +#else +#include +#endif #include #include "bh_assert.h"