Skip to content

Commit f4770ae

Browse files
authored
Add more llvm optimization passes (#445)
Add more llvm optimization passes to improve AOT/JIT performance
1 parent 892af84 commit f4770ae

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

core/iwasm/compilation/aot_llvm.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,20 @@ aot_create_comp_context(AOTCompData *comp_data,
14011401
LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr);
14021402
LLVMAddJumpThreadingPass(comp_ctx->pass_mgr);
14031403
LLVMAddConstantPropagationPass(comp_ctx->pass_mgr);
1404+
LLVMAddIndVarSimplifyPass(comp_ctx->pass_mgr);
1405+
1406+
if (!option->is_jit_mode) {
1407+
LLVMAddLoopRotatePass(comp_ctx->pass_mgr);
1408+
LLVMAddLoopUnswitchPass(comp_ctx->pass_mgr);
1409+
LLVMAddInstructionCombiningPass(comp_ctx->pass_mgr);
1410+
LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr);
1411+
LLVMAddGVNPass(comp_ctx->pass_mgr);
1412+
LLVMAddLICMPass(comp_ctx->pass_mgr);
1413+
LLVMAddLoopVectorizePass(comp_ctx->pass_mgr);
1414+
LLVMAddSLPVectorizePass(comp_ctx->pass_mgr);
1415+
LLVMAddInstructionCombiningPass(comp_ctx->pass_mgr);
1416+
LLVMAddCFGSimplificationPass(comp_ctx->pass_mgr);
1417+
}
14041418

14051419
/* Create metadata for llvm float experimental constrained intrinsics */
14061420
if (!(comp_ctx->fp_rounding_mode =

core/iwasm/compilation/aot_llvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#include "llvm-c/Object.h"
1414
#include "llvm-c/ExecutionEngine.h"
1515
#include "llvm-c/Analysis.h"
16+
#include "llvm-c/Transforms/Utils.h"
1617
#include "llvm-c/Transforms/Scalar.h"
18+
#include "llvm-c/Transforms/Vectorize.h"
1719

1820
#ifdef __cplusplus
1921
extern "C" {

0 commit comments

Comments
 (0)