-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong tbaa for ptr_phi in codegen (causes Transducers segfault) #53612
Comments
I started looking into this a bit. Didn't find anything useful yet, but did confirm where it reliably segfaults |
It looks like this happens because julia> code_llvm(eval(Expr(:new, Transducers.var"##transduce#140")), Tuple{Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, typeof(Transducers.transduce), Transducers.Composition{Transducers.AdHocXF{typeof(Main.f), Nothing, typeof(Main.flushlast)}, Transducers.Map{Type{BangBang.NoBang.SingletonVector{T} where T}}}, Transducers.AdHocRF{typeof(BangBang.collector), typeof(Base.identity), typeof(BangBang.append!!), typeof(Base.identity), typeof(Base.identity), Nothing}, BangBang.SafeCollector{BangBang.NoBang.Empty{Array{Union{}, 1}}}, Array{Base.SubString{String}, 1}}, raw=true)
%value_phi102739 = phi { ptr, i64 } [ %.result_ptr101.unbox.fca.1.insert, %L170.thread ], [ zeroinitializer, %L170 ]
%value_phi70661 = phi { ptr, i64 } [ zeroinitializer, %L120.lr.ph ], [ %value_phi102739, %guard_exit343 ]
%.fca.1.0.extract514 = extractvalue { ptr, i64 } %value_phi70661, 0, !dbg !209
store ptr %.fca.1.0.extract514, ptr %gc_slot_addr13, align 8
store ptr %.fca.1.0.extract514, ptr %.fca.1.0.gep515, align 8, !dbg !209
%.fca.1.1.extract = extractvalue { ptr, i64 } %value_phi70661, 1, !dbg !209
store i64 %.fca.1.1.extract, ptr %.fca.1.1.gep, align 8, !dbg !209
store ptr %.unpack559, ptr %gc_slot_addr12, align 16
store ptr %.unpack559, ptr %10, align 8, !dbg !209
store <2 x i64> %127, ptr %.fca.1.gep503, align 8, !dbg !209
call swiftcc void @j_f_6638(ptr noalias nocapture noundef nonnull sret({ { { ptr, i64, i64 }, ptr }, { ptr, i64 } }) %8, ptr noalias nocapture noundef nonnull %0, ptr nonnull swiftself %pgcstack, ptr nocapture nonnull readonly %3, ptr noc
apture nonnull readonly %9, ptr nocapture nonnull readonly %10), !dbg !209
...
%.result_ptr101.unbox.fca.1.insert = insertvalue { ptr, i64 } %.result_ptr101.unbox.fca.0.insert, i64 %.result_ptr101.unbox.fca.1.load, 1, !dbg !225 This comes via these julia IR snippets, which seem to be correct: │ │││││││││││ %129 = Base.getfield(%127, :result)::BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}
│ ││││││││││ %133 = invoke f(%131::Transducers.RFShim{Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), type
of(identity), Nothing}}}}, %132::Transducers.ResultShim{@NamedTuple{name::SubString{String}, lines::Vector{String}}, BangBang.SafeCollector{Empty{Vector{Union{}}}}}, %122::SubString{String})::Union{Transducers.ResultShim{@NamedTuple{name::SubString{S
tring}, lines::Vector{String}}, BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}}, Transducers.ResultShim{@NamedTuple{name::SubString{String}, lines::Vector{String}}, BangBang.SafeCollector{Empty{Vector{Unio
n{}}}}}}
│ │││││││││││ %146 = Base.getfield(%133, :result)::BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}
│ │││││││││││ %149 = Base.getfield(%133, :result)::BangBang.SafeCollector{Empty{Vector{Union{}}}}
│ ││││││││││ %152 = φ (#49 => %146, #50 => %149)::Union{BangBang.SafeCollector{Empty{Vector{Union{}}}}, BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}}
│ │││││││││ %159 = φ (#54 => %152)::BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}
58 ┄─│││││││ %170 = φ (#44 => %129, #57 => %159)::BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}
│ │││││││ %103 = φ (#62 => %170)::BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}
│ │││││││││││ %126 = %new(Transducers.ResultShim{@NamedTuple{name::SubString{String}, lines::Vector{String}}, BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}}, %102, %103)
│ ││││││││││ %127 = invoke f(%125::Transducers.RFShim{Transducers.Reduction{Map{Type{BangBang.NoBang.SingletonVector}}, Transducers.BottomRF{Transducers.AdHocRF{typeof(BangBang.collector), typeof(identity), typeof(append!!), typeof(identity), typeof(identity), Nothing}}}}, %126::Transducers.ResultShim{@NamedTuple{name::SubString{String}, lines::Vector{String}}, BangBang.SafeCollector{Vector{@NamedTuple{name::SubString{String}, lines::Vector{String}}}}}, %122::SubString{String}) So it seems like we might be missing the copy of %152 => %159 when done with LLVM optimizations that was present in the Julia IR? |
Since
|
The segfault specifically goes away if we run with The debug remarks say this is because we sort of specifically told it to do so via the aliasing info:
I don't know precisely when we generate the tbaa info for
This may be relevant: Line 5637 in 6335386
|
Fixes JuliaLang#53612 (cherry picked from commit cb47b01)
Pasting this into the REPL segfaults
The text was updated successfully, but these errors were encountered: