diff --git a/core/iwasm/compilation/aot_emit_function.c b/core/iwasm/compilation/aot_emit_function.c index 6b57a3d07..1065b4c77 100644 --- a/core/iwasm/compilation/aot_emit_function.c +++ b/core/iwasm/compilation/aot_emit_function.c @@ -881,7 +881,7 @@ aot_compile_op_call(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, } } else { -#if LLVM_VERSION_MAJOR >= 15 +#if LLVM_VERSION_MAJOR >= 14 LLVMTypeRef llvm_func_type; #endif bool recursive_call = @@ -950,7 +950,7 @@ aot_compile_op_call(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx, && !check_stack_boundary(comp_ctx, func_ctx, callee_cell_num)) goto fail; -#if LLVM_VERSION_MAJOR >= 15 +#if LLVM_VERSION_MAJOR >= 14 llvm_func_type = func_ctxes[func_idx - import_func_count]->func_type; #endif diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index d94b32d0b..755eabafd 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -2557,7 +2557,7 @@ __call_llvm_intrinsic(const AOTCompContext *comp_ctx, } } -#if LLVM_VERSION_MAJOR >= 15 +#if LLVM_VERSION_MAJOR >= 14 func_type = LLVMFunctionType(ret_type, param_types, (uint32)param_count, false); #endif diff --git a/core/iwasm/compilation/aot_llvm.h b/core/iwasm/compilation/aot_llvm.h index 4670d053c..596507537 100644 --- a/core/iwasm/compilation/aot_llvm.h +++ b/core/iwasm/compilation/aot_llvm.h @@ -37,7 +37,7 @@ extern "C" { #endif -#if LLVM_VERSION_MAJOR < 15 +#if LLVM_VERSION_MAJOR < 14 #define LLVMBuildLoad2(builder, type, value, name) \ LLVMBuildLoad(builder, value, name) diff --git a/core/iwasm/compilation/aot_llvm_extra.cpp b/core/iwasm/compilation/aot_llvm_extra.cpp index b25852cf4..5cc2019ae 100644 --- a/core/iwasm/compilation/aot_llvm_extra.cpp +++ b/core/iwasm/compilation/aot_llvm_extra.cpp @@ -492,7 +492,11 @@ aot_apply_llvm_new_pass_manager(AOTCompContext *comp_ctx) if (!disable_llvm_lto) { /* Apply LTO for AOT mode */ +#if LLVM_VERSION_MAJOR < 14 MPM.addPass(PB.buildLTODefaultPipeline(OL, NULL)); +#else + MPM.addPass(PB.buildLTOPreLinkDefaultPipeline(OL)); +#endif } else { MPM.addPass(PB.buildPerModuleDefaultPipeline(OL));