diff --git a/Compiler/src/abstractinterpretation.jl b/Compiler/src/abstractinterpretation.jl index fe3983dfa1ef2..1dd58e5743343 100644 --- a/Compiler/src/abstractinterpretation.jl +++ b/Compiler/src/abstractinterpretation.jl @@ -3691,7 +3691,7 @@ end function scan_specified_partitions(query::F1, walk_binding_partition::F2, interp::Union{AbstractInterpreter,Nothing}, g::GlobalRef, wwr::WorldWithRange) where {F1,F2} - local total_validity, rte, binding_partition + local total_validity, rte, binding_partition, kind binding = convert(Core.Binding, g) lookup_world = max_world(wwr.valid_worlds) while true @@ -3704,7 +3704,7 @@ function scan_specified_partitions(query::F1, walk_binding_partition::F2, @assert lookup_world in partition_validity this_rte = query(interp, leaf_binding, leaf_partition) if @isdefined(rte) - if this_rte === rte + if this_rte === rte && !(is_some_guard(kind) ⊻ is_some_guard(binding_kind(leaf_partition))) # Don't merge from no guard to guard total_validity = union(total_validity, partition_validity) lookup_world = min_world(total_validity) - 1 continue @@ -3716,6 +3716,7 @@ function scan_specified_partitions(query::F1, walk_binding_partition::F2, total_validity = partition_validity lookup_world = min_world(total_validity) - 1 rte = this_rte + kind = binding_kind(leaf_partition) end min_world(total_validity) > min_world(wwr.valid_worlds) || break end diff --git a/Compiler/test/codegen.jl b/Compiler/test/codegen.jl index f90ab7dff6655..8eb49212ceafa 100644 --- a/Compiler/test/codegen.jl +++ b/Compiler/test/codegen.jl @@ -1075,3 +1075,11 @@ let io = IOBuffer() str = String(take!(io)) @test occursin("julia.write_barrier", str) end + +f42559 = 5 +foo42559() = f42559 +let io = IOBuffer() + code_llvm(io, foo42559, Tuple{}, raw=true, optimize=false) + str = String(take!(io)) + @test !occursin("jl_get_binding_value_seqcst", str) +end