Skip to content

Commit

Permalink
set type of statement when processing GlobalRefs (#44200)
Browse files Browse the repository at this point in the history
Co-authored-by: Shuhei Kadowaki <[email protected]>
Co-authored-by: Jameson Nash <[email protected]>
  • Loading branch information
3 people committed Feb 18, 2022
1 parent daa0849 commit 39e849a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/compiler/ssair/ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,11 @@ function process_node!(compact::IncrementalCompact, result_idx::Int, inst::Instr
elseif isa(stmt, GotoNode) && compact.cfg_transforms_enabled
result[result_idx][:inst] = GotoNode(compact.bb_rename_succ[stmt.label])
result_idx += 1
elseif isa(stmt, GlobalRef) || isa(stmt, GotoNode)
elseif isa(stmt, GlobalRef)
result[result_idx][:inst] = stmt
result[result_idx][:type] = argextype(stmt, compact)
result_idx += 1
elseif isa(stmt, GotoNode)
result[result_idx][:inst] = stmt
result_idx += 1
elseif isa(stmt, GotoIfNot) && compact.cfg_transforms_enabled
Expand Down
12 changes: 12 additions & 0 deletions test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1069,3 +1069,15 @@ end
@test fully_eliminated() do
issue41694(2)
end

global x44200::Int = 0
function f44200()
global x = 0
while x < 10
x += 1
end
x
end
let src = code_typed1(f44200)
@test count(x -> isa(x, Core.PiNode), src.code) == 0
end

0 comments on commit 39e849a

Please sign in to comment.