Fix compilation errors for LLVM 14, refine code

This commit is contained in:
Wenyong Huang 2022-06-10 20:11:44 +08:00
parent e706de510c
commit aa999cb615
4 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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));