Skip to content

Commit 6a48cae

Browse files
authored
Merge pull request #275 from maleadt/vc/cpu_feat
add Julia wrapper for CPU features pass
2 parents 72dcad1 + e214d55 commit 6a48cae

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lib/libLLVM_julia.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,7 @@ end
5555
function LLVMAddJuliaLICMPass(PM)
5656
ccall(:LLVMExtraJuliaLICMPass,Cvoid,(LLVMPassManagerRef,), PM)
5757
end
58+
59+
function LLVMAddCPUFeaturesPass(PM)
60+
ccall(:LLVMExtraAddCPUFeaturesPass,Cvoid,(LLVMPassManagerRef,), PM)
61+
end

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-
demote_float16!, remove_ni!, julia_licm!
4+
demote_float16!, remove_ni!, julia_licm!, cpu_features!
55

66
alloc_opt!(pm::PassManager) = API.LLVMAddAllocOptPass(pm)
77

@@ -34,3 +34,9 @@ demote_float16!(pm::PassManager) = API.LLVMAddDemoteFloat16Pass(pm)
3434
remove_ni!(pm::PassManager) = API.LLVMAddRemoveNIPass(pm)
3535

3636
julia_licm!(pm::PassManager) = API.LLVMAddJuliaLICMPass(pm)
37+
38+
if VERSION >= v"1.8.0-DEV.1120"
39+
cpu_features!(pm::PassManager) = API.LLVMAddCPUFeaturesPass(pm)
40+
else
41+
cpu_features!(pm::PassManager) = nothing
42+
end

test/interop.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ lower_simdloop!(pm)
122122
remove_ni!(pm)
123123
late_lower_gc_frame!(pm)
124124
final_lower_gc!(pm)
125+
cpu_features!(pm)
125126

126127
end
127128
end

0 commit comments

Comments
 (0)