From 533b4c5ffb2627b48008b0212f7c88083ccf16da Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 10 Jan 2024 05:42:56 -0600 Subject: [PATCH] Bump to LoweredCodeUtils 2.4 Control-flow analysis changed considerably in LoweredCodeUtils 2.4 (xref https://github.com/JuliaDebug/LoweredCodeUtils.jl/issues/87). This updates to the new version. The overall trend is less reliance on `norequire` as a way of blocking certain "bad" statements, instead attempting to discover minimal statements purely by their dependencies. --- Project.toml | 2 +- src/JET.jl | 2 +- src/toplevel/virtualprocess.jl | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index ef5bd8fdd..45b52c784 100644 --- a/Project.toml +++ b/Project.toml @@ -22,7 +22,7 @@ InteractiveUtils = "1.10" JuliaInterpreter = "0.9" Libdl = "1.10" Logging = "1.10" -LoweredCodeUtils = "2.2 - 2.3" # TODO update to 2.4 +LoweredCodeUtils = "2.4" MacroTools = "0.5.6" Pkg = "1.10" PrecompileTools = "1" diff --git a/src/JET.jl b/src/JET.jl index 68591e8a3..41589d6a6 100644 --- a/src/JET.jl +++ b/src/JET.jl @@ -86,7 +86,7 @@ using Base.Experimental: @MethodTable, @overlay using LoweredCodeUtils, JuliaInterpreter using LoweredCodeUtils: - #=NamedVar,=# add_control_flow!, #=add_named_dependencies!, add_requests!,=# + #=NamedVar,=# add_control_flow!, enumerate_paths, #=add_named_dependencies!, add_requests!,=# add_ssa_preds!, add_typedefs!, callee_matches, find_typedefs, ismethod, istypedef, print_with_code, pushall!, rng diff --git a/src/toplevel/virtualprocess.jl b/src/toplevel/virtualprocess.jl index 928b137e4..e96754d2d 100644 --- a/src/toplevel/virtualprocess.jl +++ b/src/toplevel/virtualprocess.jl @@ -1181,13 +1181,13 @@ function select_dependencies!(concretize, src, edges) # push!(critical_blocks, minimum(loop) - 1) end end + # Mark the exit statement of each critical block + for i in critical_blocks + concretize[cfg.blocks[i].stmts[end]] = true + end norequire = BitSet() - for (i, block) in enumerate(cfg.blocks) - if i ∉ critical_blocks - pushall!(norequire, rng(block)) - end - end + paths = enumerate_paths(cfg) changed = true while changed @@ -1195,7 +1195,7 @@ function select_dependencies!(concretize, src, edges) # track SSA predecessors and control flows of the critical blocks changed |= add_ssa_preds!(concretize, src, edges, norequire) - changed |= add_control_flow!(concretize, cfg, norequire) + changed |= add_control_flow!(concretize, cfg, paths) end end