Skip to content

Commit c084718

Browse files
aviateskpull[bot]
authored andcommitted
EA: remove no longer used is_ipo_profitable (#51391)
1 parent 9ed82a2 commit c084718

File tree

3 files changed

+1
-28
lines changed

3 files changed

+1
-28
lines changed

base/compiler/ssair/EscapeAnalysis/EscapeAnalysis.jl

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -583,29 +583,6 @@ function ArgEscapeCache(estate::EscapeState)
583583
return ArgEscapeCache(argescapes, argaliases)
584584
end
585585

586-
"""
587-
is_ipo_profitable(ir::IRCode, nargs::Int) -> Bool
588-
589-
Heuristically checks if there is any profitability to run the escape analysis on `ir`
590-
and generate IPO escape information cache. Specifically, this function examines
591-
if any call argument is "interesting" in terms of their escapability.
592-
"""
593-
function is_ipo_profitable(ir::IRCode, nargs::Int)
594-
for i = 1:nargs
595-
t = unwrap_unionall(widenconst(ir.argtypes[i]))
596-
t <: IO && return false # bail out IO-related functions
597-
is_ipo_profitable_type(t) && return true
598-
end
599-
return false
600-
end
601-
function is_ipo_profitable_type(@nospecialize t)
602-
if isa(t, Union)
603-
return is_ipo_profitable_type(t.a) && is_ipo_profitable_type(t.b)
604-
end
605-
(t === String || t === Symbol || t === Module || t === SimpleVector) && return false
606-
return ismutabletype(t)
607-
end
608-
609586
abstract type Change end
610587
struct EscapeChange <: Change
611588
xidx::Int

doc/src/devdocs/EscapeAnalysis.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,10 @@ non-inlined callees that has been derived by previous `IPO EA`.
365365
More interestingly, it is also valid to use `IPO EA` escape information for type inference,
366366
e.g., inference accuracy can be improved by forming `Const`/`PartialStruct`/`MustAlias` of mutable object.
367367

368-
Since the computational cost of `analyze_escapes` is not that cheap,
369-
both `IPO EA` and `Local EA` are better to run only when there is any profitability.
370-
Currently `EscapeAnalysis` provides the `is_ipo_profitable` heuristic to check a profitability of `IPO EA`.
371368
```@docs
372369
Core.Compiler.EscapeAnalysis.analyze_escapes
373370
Core.Compiler.EscapeAnalysis.EscapeState
374371
Core.Compiler.EscapeAnalysis.EscapeInfo
375-
Core.Compiler.EscapeAnalysis.is_ipo_profitable
376372
```
377373

378374
--------------------------------------------------------------------------------------------

test/compiler/EscapeAnalysis/EAUtils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ using .CC:
6565
InferenceResult, OptimizationState, IRCode, copy as cccopy,
6666
@timeit, convert_to_ircode, slot2reg, compact!, ssa_inlining_pass!, sroa_pass!,
6767
adce_pass!, JLOptions, verify_ir, verify_linetable
68-
using .EA: analyze_escapes, ArgEscapeCache, EscapeInfo, EscapeState, is_ipo_profitable
68+
using .EA: analyze_escapes, ArgEscapeCache, EscapeInfo, EscapeState
6969

7070
struct CodeCache
7171
cache::IdDict{MethodInstance,CodeInstance}

0 commit comments

Comments
 (0)