File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -394,11 +394,26 @@ iterate(it::UseRefIterator) = (it.use[1].op = 0; iterate(it, nothing))
394
394
end
395
395
end
396
396
397
+ function scan_ssa_use_recursive! (push!, used, @nospecialize (a))
398
+ if isa (a, SSAValue)
399
+ push! (used, a. id)
400
+ elseif isa (a, Expr)
401
+ for aa in a. args
402
+ scan_ssa_use_recursive! (push!, used, aa)
403
+ end
404
+ end
405
+ return used
406
+ end
407
+
397
408
# This function is used from the show code, which may have a different
398
409
# `push!`/`used` type since it's in Base.
399
410
function scan_ssa_use! (push!, used, @nospecialize (stmt))
400
411
if isa (stmt, SSAValue)
401
412
push! (used, stmt. id)
413
+ elseif isexpr (stmt, :struct_type )
414
+ for a in stmt. args
415
+ scan_ssa_use_recursive! (push!, used, a)
416
+ end
402
417
end
403
418
for useref in userefs (stmt)
404
419
val = useref[]
Original file line number Diff line number Diff line change 81
81
# XXX : missing @test
82
82
end
83
83
84
+ let
85
+ ex = quote
86
+ function fouter (x)
87
+ finner (:: Float16 ) = 2 x
88
+ return finner (Float16 (1 ))
89
+ end
90
+ end
91
+ thunk1 = Meta. lower (Main, ex)
92
+ thunk2 = thunk1. args[1 ]. code[2 ]
93
+ code = thunk2. args[1 ]
94
+ used = BitSet ()
95
+ for stmt in code. code
96
+ Compiler. scan_ssa_use! (push!, used, stmt)
97
+ end
98
+ @test ! isempty (used)
99
+ end
100
+
84
101
for compile in (" min" , " yes" )
85
102
cmd = ` $(Base. julia_cmd ()) --compile=$compile interpreter_exec.jl`
86
103
if ! success (pipeline (Cmd (cmd, dir= @__DIR__ ); stdout = stdout , stderr = stderr ))
You can’t perform that action at this time.
0 commit comments