diff --git a/src/EscapeAnalysis.jl b/src/EscapeAnalysis.jl index 4a56ddd..260a4ae 100644 --- a/src/EscapeAnalysis.jl +++ b/src/EscapeAnalysis.jl @@ -645,7 +645,14 @@ function inter_ainfo(AInfo::AInfo, estate::EscapeState) if isa(x, LocalUse) UseEscapeBits |= encode_escape_bits(estate[SSAValue(x.idx)]) elseif isa(x, InterUse) - UseEscapeBits |= x.EscapeBits + EscapeBits = x.EscapeBits + for v in x.aliases + info = estate[v] + if info !== nothing + EscapeBits |= encode_escape_bits(info) + end + end + UseEscapeBits |= EscapeBits else x = x::Definition v = x.val @@ -1117,6 +1124,8 @@ end struct InterUse idx::Int EscapeBits::UInt8 + aliases::IdSet{Any} + InterUse(idx::Int, EscapeBits::UInt8) = new(idx, EscapeBits, IdSet{Any}()) end function add_alias_escapes!(astate::AnalysisState, @nospecialize(v), AInfo::AInfo) @@ -1142,6 +1151,7 @@ function add_alias_escapes!(astate::AnalysisState, @nospecialize(v), AInfo::AInf end add_escape_change!(astate, v, interinfo) end + push!(x.aliases, v) else @assert isa(x, Definition) continue # ignore def