Skip to content

Commit 5e15809

Browse files
committed
Add demote_float16 pass
1 parent bec0d23 commit 5e15809

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

lib/libLLVM_extra.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ function LLVMAddRemoveJuliaAddrspacesPass(PM)
168168
end
169169
end
170170

171+
if VERSION >= v"1.6.0-DEV.1215"
172+
function LLVMAddDemoteFloat16Pass(PM)
173+
ccall(:LLVMExtraAddDemoteFloat16Pass,Cvoid,(LLVMPassManagerRef,), PM)
174+
end
175+
end
176+
171177
if VERSION >= v"1.6.0-DEV.1476"
172178
function LLVMAddRemoveNIPass(PM)
173179
ccall(:LLVMExtraAddRemoveNIPass,Cvoid,(LLVMPassManagerRef,), PM)

src/interop/passes.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export alloc_opt!, barrier_noop!, gc_invariant_verifier!, lower_exc_handlers!,
22
combine_mul_add!, multi_versioning!, propagate_julia_addrsp!, lower_ptls!,
33
lower_simdloop!, late_lower_gc_frame!, final_lower_gc!, remove_julia_addrspaces!,
4-
remove_ni!, julia_licm!
4+
demote_float16!, remove_ni!, julia_licm!
55

66
alloc_opt!(pm::PassManager) =
77
API.LLVMAddAllocOptPass(pm)
@@ -46,6 +46,12 @@ else
4646
remove_julia_addrspaces!(pm::PassManager) = nothing
4747
end
4848

49+
if VERSION >= v"1.6.0-DEV.1215"
50+
demote_float16!(pm::PassManager) = API.LLVMAddDemoteFloat16Pass(pm)
51+
else
52+
demote_float16!(pm::PassManager) = nothing
53+
end
54+
4955
if VERSION >= v"1.6.0-DEV.1476"
5056
remove_ni!(pm::PassManager) = API.LLVMAddRemoveNIPass(pm)
5157
else

test/interop.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ Context() do ctx
116116
LLVM.Module("SomeModule", ctx) do mod
117117
ModulePassManager() do pm
118118

119+
demote_float16!(pm)
119120
julia_licm!(pm)
120121
alloc_opt!(pm)
121122
barrier_noop!(pm)

0 commit comments

Comments
 (0)