Skip to content

Commit b574954

Browse files
committed
add new passes exported from Julia
1 parent 17d1cc8 commit b574954

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

lib/libLLVM_extra.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,42 @@ function LLVMAddJuliaLICMPass(PM)
186186
end
187187
end
188188

189+
if VERSION >= v"1.6.0-DEV.1503"
190+
function LLVMAddDivRemPairsPass(PM)
191+
ccall(:LLVMExtraAddDivRemPairsPass,Cvoid,(LLVMPassManagerRef,), PM)
192+
end
193+
end
194+
195+
if VERSION >= v"1.6.0-DEV.1503"
196+
function LLVMAddLoopDistributePass(PM)
197+
ccall(:LLVMExtraAddLoopDistributePass,Cvoid,(LLVMPassManagerRef,), PM)
198+
end
199+
end
200+
201+
if VERSION >= v"1.6.0-DEV.1503"
202+
function LLVMAddLoopFusePass(PM)
203+
ccall(:LLVMExtraAddLoopFusePass,Cvoid,(LLVMPassManagerRef,), PM)
204+
end
205+
end
206+
207+
if VERSION >= v"1.6.0-DEV.1503"
208+
function LLVMAddLoopLoadEliminationPass(PM)
209+
ccall(:LLVMExtraLoopLoadEliminationPass,Cvoid,(LLVMPassManagerRef,), PM)
210+
end
211+
end
212+
213+
if VERSION >= v"1.6.0-DEV.1503"
214+
function LLVMAddLoadStoreVectorizerPass(PM)
215+
ccall(:LLVMExtraAddLoadStoreVectorizerPass,Cvoid,(LLVMPassManagerRef,), PM)
216+
end
217+
end
218+
219+
if VERSION >= v"1.6.0-DEV.1503"
220+
function LLVMAddInstSimplifyPass(PM)
221+
ccall(:LLVMExtraAddInstructionSimplifyPass,Cvoid,(LLVMPassManagerRef,), PM)
222+
end
223+
end
224+
189225
function LLVMGetValueContext(V)
190226
ccall(:LLVMExtraGetValueContext,LLVMContextRef,(LLVMValueRef,),V)
191227
end

src/transform.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,17 @@ scalar_repl_aggregates_ssa!(pm::PassManager) =
118118

119119
define_transforms([:DCE], version() >= v"10.0")
120120

121+
define_transforms([
122+
:DivRemPairs, :LoopDistribute, :LoopFuse, :LoopLoadElimination, :InstSimplify
123+
], VERSION >= v"1.6.0-DEV.1503")
124+
121125
## vectorization transformations
122126

123127
define_transforms([
124128
:LoopVectorize, :SLPVectorize
125129
])
126130

131+
define_transforms([:LoadStoreVectorizer], VERSION >= v"1.6.0-DEV.1503")
127132

128133
## interprocedural transformations
129134

test/transform.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ ModulePassManager() do pm
3838
scalarizer!(pm)
3939
merged_load_store_motion!(pm)
4040
gvn!(pm)
41+
div_rem_pairs!(pm)
4142
ind_var_simplify!(pm)
4243
instruction_combining!(pm)
44+
inst_simplify!(pm)
4345
jump_threading!(pm)
4446
licm!(pm)
4547
loop_deletion!(pm)
@@ -48,7 +50,11 @@ ModulePassManager() do pm
4850
loop_reroll!(pm)
4951
loop_unroll!(pm)
5052
loop_unswitch!(pm)
53+
loop_distribute!(pm)
54+
loop_fuse!(pm)
55+
loop_load_elimination!(pm)
5156
mem_cpy_opt!(pm)
57+
5258
partially_inline_lib_calls!(pm)
5359
lower_switch!(pm)
5460
promote_memory_to_register!(pm)
@@ -71,6 +77,7 @@ ModulePassManager() do pm
7177

7278
loop_vectorize!(pm)
7379
slpvectorize!(pm)
80+
load_store_vectorizer!(pm)
7481

7582
argument_promotion!(pm)
7683
constant_merge!(pm)

0 commit comments

Comments
 (0)