Skip to content

Commit c30ff93

Browse files
committed
just define EA
1 parent 7081984 commit c30ff93

File tree

4 files changed

+6
-14
lines changed

4 files changed

+6
-14
lines changed

base/compiler/optimize.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,7 @@ function run_passes(ci::CodeInfo, sv::OptimizationState)
518518
@timeit "Inlining" ir = ssa_inlining_pass!(ir, ir.linetable, sv.inlining, ci.propagate_inbounds)
519519
# @timeit "verify 2" verify_ir(ir)
520520
@timeit "compact 2" ir = compact!(ir)
521-
nargs = let def = sv.linfo.def; isa(def, Method) ? Int(def.nargs) : 0; end
522-
@timeit "SROA" ir = sroa_pass!(ir, nargs)
521+
@timeit "SROA" ir = sroa_pass!(ir)
523522
@timeit "ADCE" ir = adce_pass!(ir)
524523
@timeit "type lift" ir = type_lift_pass!(ir)
525524
@timeit "compact 3" ir = compact!(ir)

base/compiler/ssair/EscapeAnalysis/EAUtils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function run_passes_with_ea(interp::EscapeAnalyzer, ci::CodeInfo, sv::Optimizati
275275
interp.ir = cacheir
276276
interp.state = state
277277
interp.linfo = sv.linfo
278-
@timeit "SROA" ir = sroa_pass!(ir, nargs)
278+
@timeit "SROA" ir = sroa_pass!(ir)
279279
@timeit "ADCE" ir = adce_pass!(ir)
280280
@timeit "type lift" ir = type_lift_pass!(ir)
281281
@timeit "compact 3" ir = compact!(ir)

base/compiler/ssair/passes.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ its argument).
674674
In a case when all usages are fully eliminated, `struct` allocation may also be erased as
675675
a result of succeeding dead code elimination.
676676
"""
677-
function sroa_pass!(ir::IRCode, nargs::Int)
677+
function sroa_pass!(ir::IRCode)
678678
compact = IncrementalCompact(ir)
679679
defuses = nothing # will be initialized once we encounter mutability in order to reduce dynamic allocations
680680
lifting_cache = IdDict{Pair{AnySSAValue, Any}, AnySSAValue}()
@@ -846,18 +846,17 @@ function sroa_pass!(ir::IRCode, nargs::Int)
846846
used_ssas = copy(compact.used_ssas)
847847
simple_dce!(compact, (x::SSAValue) -> used_ssas[x.id] -= 1)
848848
ir = complete(compact)
849-
sroa_mutables!(ir, defuses, used_ssas, nargs)
849+
sroa_mutables!(ir, defuses, used_ssas)
850850
return ir
851851
else
852852
simple_dce!(compact)
853853
return complete(compact)
854854
end
855855
end
856856

857-
function sroa_mutables!(ir::IRCode, defuses::IdDict{Int, Tuple{SPCSet, SSADefUse}}, used_ssas::Vector{Int}, nargs::Int)
857+
function sroa_mutables!(ir::IRCode, defuses::IdDict{Int, Tuple{SPCSet, SSADefUse}}, used_ssas::Vector{Int})
858858
# initialization of domtree is delayed to avoid the expensive computation in many cases
859859
local domtree = nothing
860-
estate = analyze_escapes(ir, nargs)
861860
for (idx, (intermediaries, defuse)) in defuses
862861
intermediaries = collect(intermediaries)
863862
# Check if there are any uses we did not account for. If so, the variable
@@ -933,7 +932,6 @@ function sroa_mutables!(ir::IRCode, defuses::IdDict{Int, Tuple{SPCSet, SSADefUse
933932
end
934933
end
935934
end
936-
is_load_forwardable(estate[SSAValue(idx)]) || println("[EA] bad EA: ", ir.argtypes[1:nargs], " at ", idx)
937935
# Everything accounted for. Go field by field and perform idf:
938936
# Compute domtree now, needed below, now that we have finished compacting the IR.
939937
# This needs to be after we iterate through the IR with `IncrementalCompact`
@@ -992,11 +990,6 @@ function sroa_mutables!(ir::IRCode, defuses::IdDict{Int, Tuple{SPCSet, SSADefUse
992990
end
993991
end
994992

995-
function is_load_forwardable(x::EscapeAnalysis.EscapeInfo)
996-
AliasInfo = x.AliasInfo
997-
return isa(AliasInfo, EscapeAnalysis.IndexableFields)
998-
end
999-
1000993
function form_new_preserves(origex::Expr, intermediates::Vector{Int}, new_preserves::Vector{Any})
1001994
newex = Expr(:foreigncall)
1002995
nccallargs = length(origex.args[3]::SimpleVector)

test/compiler/irpasses.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ let m = Meta.@lower 1 + 1
518518
src.ssaflags = fill(Int32(0), nstmts)
519519
ir = Core.Compiler.inflate_ir(src, Any[], Any[Any, Any])
520520
@test Core.Compiler.verify_ir(ir) === nothing
521-
ir = @test_nowarn Core.Compiler.sroa_pass!(ir, 0)
521+
ir = @test_nowarn Core.Compiler.sroa_pass!(ir)
522522
@test Core.Compiler.verify_ir(ir) === nothing
523523
end
524524

0 commit comments

Comments
 (0)