-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopt.cpp
More file actions
26 lines (25 loc) · 882 Bytes
/
opt.cpp
File metadata and controls
26 lines (25 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "opt.h"
using namespace llvm;
legacy::PassManager Optimize() {
legacy::PassManager pm;
pm.add(createConstantPropagationPass());
pm.add(createConstantHoistingPass());
pm.add(createPromoteMemoryToRegisterPass());
// pm.add(createLoopInstSimplifyPass());
pm.add(createLoopUnrollPass());
pm.add(createLoadCombinePass());
pm.add(createLoopSimplifyPass());
pm.add(createReassociatePass());
pm.add(createGVNPass());
pm.add(createCFGSimplificationPass());
pm.add(createDeadCodeEliminationPass());
pm.add(createDeadInstEliminationPass());
for (int i = 0; i < 5; ++i)
pm.add(createDeadStoreEliminationPass());
pm.add(createPromoteMemoryToRegisterPass());
pm.add(createAggressiveDCEPass());
pm.add(createLCSSAPass());
pm.add(createPrintModulePass(outs()));
// pm.doInitialization();
return pm;
}