Skip to content

Commit b9da60f

Browse files
committed
improve some assertions in base/compiler/ssair/passes.jl
1 parent 7662661 commit b9da60f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

base/compiler/ssair/passes.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ function val_for_def_expr(ir::IRCode, def::Int, fidx::Int)
8383
if isexpr(ex, :new)
8484
return ex.args[1+fidx]
8585
else
86-
@assert isa(ex, Expr)
87-
# The use is whatever the setfield was
86+
@assert is_known_call(ex, setfield!, ir)
8887
return ex.args[4]
8988
end
9089
end
@@ -939,7 +938,7 @@ function pattern_match_typeof(compact::IncrementalCompact, typ::DataType, fidx::
939938
push!(tvars, applyTvar)
940939
end
941940

942-
applyT.name === typ.name || return false
941+
@assert applyT.name === typ.name
943942
fT = fieldtype(applyT, fidx)
944943
idx = findfirst(IsEgal(fT), tvars)
945944
idx === nothing && return false
@@ -1106,15 +1105,14 @@ function sroa_pass!(ir::IRCode, inlining::Union{Nothing,InliningState}=nothing)
11061105
val = stmt.args[2]
11071106
end
11081107
struct_typ = widenconst(argextype(val, compact))
1109-
struct_typ_name = argument_datatype(struct_typ)
1110-
if struct_typ_name === nothing
1108+
struct_argtyp = argument_datatype(struct_typ)
1109+
if struct_argtyp === nothing
11111110
if isa(struct_typ, Union)
11121111
lift_comparison!(isdefined, compact, idx, stmt, lifting_cache, 𝕃ₒ)
11131112
end
11141113
continue
1115-
else
1116-
struct_typ_name = struct_typ_name.name
11171114
end
1115+
struct_typ_name = struct_argtyp.name
11181116

11191117
struct_typ_name.atomicfields == C_NULL || continue # TODO: handle more
11201118
if !((field_ordering === :unspecified) ||

0 commit comments

Comments
 (0)