Skip to content

Commit eaa85ba

Browse files
Merge pull request #36 from SciML/dw/ptr
Fix deprecations in Julia 1.12
2 parents 7801b04 + 44b75d6 commit eaa85ba

File tree

3 files changed

+66
-64
lines changed

3 files changed

+66
-64
lines changed

.github/workflows/Tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ jobs:
3636
with:
3737
julia-version: "${{ matrix.version }}"
3838
os: "${{ matrix.os }}"
39+
julia-runtest-depwarn: "error"
3940
secrets: "inherit"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "FindFirstFunctions"
22
uuid = "64ca27bc-2ba2-4a57-88aa-44e436879224"
33
authors = ["Chris Elrod <elrodc@gmail.com> and contributors"]
4-
version = "1.4.1"
4+
version = "1.4.2"
55

66
[compat]
77
Aqua = "0.8"

src/FindFirstFunctions.jl

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,71 @@
11
module FindFirstFunctions
22

3+
# https://github.com/JuliaLang/julia/pull/53687
4+
const USE_PTR = VERSION >= v"1.12.0-DEV.255"
5+
const FFE_IR = """
6+
declare i8 @llvm.cttz.i8(i8, i1);
7+
define i64 @entry(i64 %0, $(USE_PTR ? "ptr" : "i64") %1, i64 %2) #0 {
8+
top:
9+
$(USE_PTR ? "" : "%ivars = inttoptr i64 %1 to i64*")
10+
%btmp = insertelement <8 x i64> undef, i64 %0, i64 0
11+
%var = shufflevector <8 x i64> %btmp, <8 x i64> undef, <8 x i32> zeroinitializer
12+
%lenm7 = add nsw i64 %2, -7
13+
%dosimditer = icmp ugt i64 %2, 7
14+
br i1 %dosimditer, label %L9.lr.ph, label %L32
15+
16+
L9.lr.ph:
17+
%len8 = and i64 %2, 9223372036854775800
18+
br label %L9
19+
20+
L9:
21+
%i = phi i64 [ 0, %L9.lr.ph ], [ %vinc, %L30 ]
22+
%ivarsi = getelementptr inbounds i64, $(USE_PTR ? "ptr %1" : "i64* %ivars"), i64 %i
23+
$(USE_PTR ? "" : "%vpvi = bitcast i64* %ivarsi to <8 x i64>*")
24+
%v = load <8 x i64>, $(USE_PTR ? "ptr %ivarsi" : "<8 x i64> * %vpvi"), align 8
25+
%m = icmp eq <8 x i64> %v, %var
26+
%mu = bitcast <8 x i1> %m to i8
27+
%matchnotfound = icmp eq i8 %mu, 0
28+
br i1 %matchnotfound, label %L30, label %L17
29+
30+
L17:
31+
%tz8 = call i8 @llvm.cttz.i8(i8 %mu, i1 true)
32+
%tz64 = zext i8 %tz8 to i64
33+
%vis = add nuw i64 %i, %tz64
34+
br label %common.ret
35+
36+
common.ret:
37+
%retval = phi i64 [ %vis, %L17 ], [ -1, %L32 ], [ %si, %L51 ], [ -1, %L67 ]
38+
ret i64 %retval
39+
40+
L30:
41+
%vinc = add nuw nsw i64 %i, 8
42+
%continue = icmp slt i64 %vinc, %lenm7
43+
br i1 %continue, label %L9, label %L32
44+
45+
L32:
46+
%cumi = phi i64 [ 0, %top ], [ %len8, %L30 ]
47+
%done = icmp eq i64 %cumi, %2
48+
br i1 %done, label %common.ret, label %L51
49+
50+
L51:
51+
%si = phi i64 [ %inc, %L67 ], [ %cumi, %L32 ]
52+
%spi = getelementptr inbounds i64, $(USE_PTR ? "ptr %1" : "i64* %ivars"), i64 %si
53+
%svi = load i64, $(USE_PTR ? "ptr" : "i64*") %spi, align 8
54+
%match = icmp eq i64 %svi, %0
55+
br i1 %match, label %common.ret, label %L67
56+
57+
L67:
58+
%inc = add i64 %si, 1
59+
%dobreak = icmp eq i64 %inc, %2
60+
br i1 %dobreak, label %common.ret, label %L51
61+
62+
}
63+
attributes #0 = { alwaysinline }
64+
"""
65+
366
function _findfirstequal(vpivot::Int64, ptr::Ptr{Int64}, len::Int64)
467
Base.llvmcall(
5-
(
6-
"""
7-
declare i8 @llvm.cttz.i8(i8, i1);
8-
define i64 @entry(i64 %0, i64 %1, i64 %2) #0 {
9-
top:
10-
%ivars = inttoptr i64 %1 to i64*
11-
%btmp = insertelement <8 x i64> undef, i64 %0, i64 0
12-
%var = shufflevector <8 x i64> %btmp, <8 x i64> undef, <8 x i32> zeroinitializer
13-
%lenm7 = add nsw i64 %2, -7
14-
%dosimditer = icmp ugt i64 %2, 7
15-
br i1 %dosimditer, label %L9.lr.ph, label %L32
16-
17-
L9.lr.ph:
18-
%len8 = and i64 %2, 9223372036854775800
19-
br label %L9
20-
21-
L9:
22-
%i = phi i64 [ 0, %L9.lr.ph ], [ %vinc, %L30 ]
23-
%ivarsi = getelementptr inbounds i64, i64* %ivars, i64 %i
24-
%vpvi = bitcast i64* %ivarsi to <8 x i64>*
25-
%v = load <8 x i64>, <8 x i64>* %vpvi, align 8
26-
%m = icmp eq <8 x i64> %v, %var
27-
%mu = bitcast <8 x i1> %m to i8
28-
%matchnotfound = icmp eq i8 %mu, 0
29-
br i1 %matchnotfound, label %L30, label %L17
30-
31-
L17:
32-
%tz8 = call i8 @llvm.cttz.i8(i8 %mu, i1 true)
33-
%tz64 = zext i8 %tz8 to i64
34-
%vis = add nuw i64 %i, %tz64
35-
br label %common.ret
36-
37-
common.ret:
38-
%retval = phi i64 [ %vis, %L17 ], [ -1, %L32 ], [ %si, %L51 ], [ -1, %L67 ]
39-
ret i64 %retval
40-
41-
L30:
42-
%vinc = add nuw nsw i64 %i, 8
43-
%continue = icmp slt i64 %vinc, %lenm7
44-
br i1 %continue, label %L9, label %L32
45-
46-
L32:
47-
%cumi = phi i64 [ 0, %top ], [ %len8, %L30 ]
48-
%done = icmp eq i64 %cumi, %2
49-
br i1 %done, label %common.ret, label %L51
50-
51-
L51:
52-
%si = phi i64 [ %inc, %L67 ], [ %cumi, %L32 ]
53-
%spi = getelementptr inbounds i64, i64* %ivars, i64 %si
54-
%svi = load i64, i64* %spi, align 8
55-
%match = icmp eq i64 %svi, %0
56-
br i1 %match, label %common.ret, label %L67
57-
58-
L67:
59-
%inc = add i64 %si, 1
60-
%dobreak = icmp eq i64 %inc, %2
61-
br i1 %dobreak, label %common.ret, label %L51
62-
63-
}
64-
attributes #0 = { alwaysinline }
65-
""",
66-
"entry"
67-
),
68+
(FFE_IR, "entry"),
6869
Int64,
6970
Tuple{Int64, Ptr{Int64}, Int64},
7071
vpivot,

0 commit comments

Comments
 (0)