Skip to content

Commit e2e780b

Browse files
committed
More fix
1 parent e049fa9 commit e2e780b

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

src/codeedges.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -902,17 +902,6 @@ function add_control_flow!(isrequired, src, cfg, domtree, postdomtree)
902902
# end
903903
end
904904
end
905-
if !ok
906-
print_with_code(stdout, src, isrequired)
907-
@show ibb jbb ipbb
908-
ipbb = postdomtree.idoms_bb[ibb]
909-
print("ibb postdoms: ")
910-
while ipbb != 0
911-
print(ipbb, " ")
912-
ipbb = postdomtree.idoms_bb[ipbb]
913-
end
914-
println()
915-
end
916905
jbb <= length(blocks) && @assert ok
917906
end
918907
return changed
@@ -953,7 +942,7 @@ function add_typedefs!(isrequired, src::CodeInfo, edges::CodeEdges, (typedef_blo
953942
stmt = stmts[idx]
954943
isrequired[idx] == true || (idx += 1; continue)
955944
for (typedefr, typedefn) in zip(typedef_blocks, typedef_names)
956-
if idx typedefr
945+
if idx typedefr && !iscf(stmt) # exclude control-flow nodes since they may be needed for other purposes
957946
ireq = view(isrequired, typedefr)
958947
if !all(==(true), ireq)
959948
changed = true

test/codeedges.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ module ModSelective end
219219
# Final block is not a `return`
220220
ex = quote
221221
x = 1
222-
y = 7
222+
yy = 7
223223
@label loop
224224
x += 1
225-
x < 5 || return y
225+
x < 5 || return yy
226226
@goto loop
227227
end
228228
frame = Frame(ModSelective, ex)
@@ -231,7 +231,7 @@ module ModSelective end
231231
isrequired = lines_required(GlobalRef(ModSelective, :x), src, edges)
232232
selective_eval_fromstart!(frame, isrequired, true)
233233
@test ModSelective.x == 5
234-
@test !isdefined(ModSelective, :y)
234+
@test !isdefined(ModSelective, :yy)
235235

236236
# Control-flow in an abstract type definition
237237
ex = :(abstract type StructParent{T, N} <: AbstractArray{T, N} end)
@@ -326,7 +326,7 @@ module ModSelective end
326326
if iblock == length(bbs.blocks)
327327
@test any(idx->isrequired[idx]==true, r)
328328
else
329-
@test !any(idx->isrequired[idx]==true, r)
329+
@test !any(idx->isrequired[idx]==true && !LoweredCodeUtils.iscf(src.code[idx]), r)
330330
end
331331
end
332332

0 commit comments

Comments
 (0)