Skip to content

Commit ccb8b07

Browse files
authored
Merge branch 'codezonediitj:main' into graph_llvm
2 parents 49174dc + 0c258ff commit ccb8b07

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pydatastructs/linear_data_structures/_backend/cpp/algorithms/llvm_algorithms.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,32 @@ def _materialize(dtype: str) -> int:
145145
mod = binding.parse_assembly(llvm_ir)
146146
mod.verify()
147147

148+
pmb = binding.PassManagerBuilder()
149+
pmb.opt_level = 3
150+
pmb.loop_vectorize = True
151+
pmb.slp_vectorize = True
152+
153+
fpm = binding.create_function_pass_manager(mod)
154+
pm = binding.create_module_pass_manager()
155+
156+
pm.add_basic_alias_analysis_pass()
157+
pm.add_type_based_alias_analysis_pass()
158+
pm.add_instruction_combining_pass()
159+
pm.add_gvn_pass()
160+
pm.add_cfg_simplification_pass()
161+
pm.add_loop_unroll_pass()
162+
pm.add_loop_unswitch_pass()
163+
164+
pmb.populate(fpm)
165+
pmb.populate(pm)
166+
167+
fpm.initialize()
168+
for func in mod.functions:
169+
fpm.run(func)
170+
fpm.finalize()
171+
172+
pm.run(mod)
173+
148174
engine = binding.create_mcjit_compiler(mod, _target_machine)
149175
engine.finalize_object()
150176
engine.run_static_constructors()

0 commit comments

Comments
 (0)