@@ -22,9 +22,14 @@ function get_llvm(@nospecialize(f), @nospecialize(t), raw=true, dump_module=fals
22
22
sprint (print, d)
23
23
end
24
24
25
+ # Some tests assume calls should be stripped out,
26
+ # so strip out the calls to debug intrinsics that
27
+ # are not actually materialized as call instructions.
28
+ strip_debug_calls (ir) = replace (ir, r" call void @llvm\. dbg\. declare.*\n " => " " , r" call void @llvm\. dbg\. value.*\n " => " " )
29
+
25
30
if ! is_debug_build && opt_level > 0
26
31
# Make sure getptls call is removed at IR level with optimization on
27
- @test ! occursin (" call " , get_llvm (identity, Tuple{String}))
32
+ @test ! occursin (" call " , strip_debug_calls ( get_llvm (identity, Tuple{String}) ))
28
33
end
29
34
30
35
jl_string_ptr (s:: String ) = ccall (:jl_string_ptr , Ptr{UInt8}, (Any,), s)
@@ -114,22 +119,22 @@ end
114
119
115
120
if ! is_debug_build && opt_level > 0
116
121
# Make sure `jl_string_ptr` is inlined
117
- @test ! occursin (" call " , get_llvm (jl_string_ptr, Tuple{String}))
122
+ @test ! occursin (" call " , strip_debug_calls ( get_llvm (jl_string_ptr, Tuple{String}) ))
118
123
# Make sure `Core.sizeof` call is inlined
119
124
s = " aaa"
120
125
@test jl_string_ptr (s) == pointer_from_objref (s) + sizeof (Int)
121
126
# String
122
- test_loads_no_call (get_llvm (core_sizeof, Tuple{String}), [Iptr])
127
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{String}) ), [Iptr])
123
128
# String
124
- test_loads_no_call (get_llvm (core_sizeof, Tuple{Core. SimpleVector}), [Iptr])
129
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{Core. SimpleVector}) ), [Iptr])
125
130
# Array
126
- test_loads_no_call (get_llvm (core_sizeof, Tuple{Vector{Int}}), [Iptr])
131
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{Vector{Int}}) ), [Iptr])
127
132
# As long as the eltype is known we don't need to load the elsize
128
- test_loads_no_call (get_llvm (core_sizeof, Tuple{Array{Any}}), [Iptr])
133
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{Array{Any}}) ), [Iptr])
129
134
# Check that we load the elsize
130
- test_loads_no_call (get_llvm (core_sizeof, Tuple{Vector}), [Iptr, " i16" ])
135
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{Vector}) ), [Iptr, " i16" ])
131
136
# Primitive Type size should be folded to a constant
132
- test_loads_no_call (get_llvm (core_sizeof, Tuple{Ptr}), String[])
137
+ test_loads_no_call (strip_debug_calls ( get_llvm (core_sizeof, Tuple{Ptr}) ), String[])
133
138
134
139
test_jl_dump_compiles ()
135
140
test_jl_dump_compiles_toplevel_thunks ()
@@ -791,7 +796,7 @@ f48085(@nospecialize x...) = length(x)
791
796
@test Core. Compiler. get_compileable_sig (which (f48085, (Vararg{Any},)), Tuple{typeof (f48085), Int, Vararg{Int}}, Core. svec ()) === Tuple{typeof (f48085), Any, Vararg{Any}}
792
797
793
798
# Make sure that the bounds check is elided in tuple iteration
794
- @test ! occursin (" call void @" , get_llvm (iterate, Tuple{NTuple{4 , Float64}, Int}))
799
+ @test ! occursin (" call void @" , strip_debug_calls ( get_llvm (iterate, Tuple{NTuple{4 , Float64}, Int}) ))
795
800
796
801
# issue #34459
797
802
function f34459 (args... )
0 commit comments