diff --git a/core/iwasm/compilation/aot_llvm.c b/core/iwasm/compilation/aot_llvm.c index 371f69cdb..352d53989 100644 --- a/core/iwasm/compilation/aot_llvm.c +++ b/core/iwasm/compilation/aot_llvm.c @@ -1401,6 +1401,20 @@ aot_create_comp_context(AOTCompData *comp_data, LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr); LLVMAddJumpThreadingPass(comp_ctx->pass_mgr); LLVMAddConstantPropagationPass(comp_ctx->pass_mgr); + LLVMAddIndVarSimplifyPass(comp_ctx->pass_mgr); + + if (!option->is_jit_mode) { + LLVMAddLoopRotatePass(comp_ctx->pass_mgr); + LLVMAddLoopUnswitchPass(comp_ctx->pass_mgr); + LLVMAddInstructionCombiningPass(comp_ctx->pass_mgr); + LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr); + LLVMAddGVNPass(comp_ctx->pass_mgr); + LLVMAddLICMPass(comp_ctx->pass_mgr); + LLVMAddLoopVectorizePass(comp_ctx->pass_mgr); + LLVMAddSLPVectorizePass(comp_ctx->pass_mgr); + LLVMAddInstructionCombiningPass(comp_ctx->pass_mgr); + LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr); + } /* Create metadata for llvm float experimental constrained intrinsics */ if (!(comp_ctx->fp_rounding_mode = diff --git a/core/iwasm/compilation/aot_llvm.h b/core/iwasm/compilation/aot_llvm.h index 3da5ea98e..30163a8b1 100644 --- a/core/iwasm/compilation/aot_llvm.h +++ b/core/iwasm/compilation/aot_llvm.h @@ -13,7 +13,9 @@ #include "llvm-c/Object.h" #include "llvm-c/ExecutionEngine.h" #include "llvm-c/Analysis.h" +#include "llvm-c/Transforms/Utils.h" #include "llvm-c/Transforms/Scalar.h" +#include "llvm-c/Transforms/Vectorize.h" #ifdef __cplusplus extern "C" {