Skip to content

Commit 39e849a

Browse files
simeonschaubaviateskvtjnash
authored
set type of statement when processing GlobalRefs (JuliaLang#44200)
Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Co-authored-by: Jameson Nash <vtjnash@gmail.com>
1 parent daa0849 commit 39e849a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

base/compiler/ssair/ir.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,11 @@ function process_node!(compact::IncrementalCompact, result_idx::Int, inst::Instr
10001000
elseif isa(stmt, GotoNode) && compact.cfg_transforms_enabled
10011001
result[result_idx][:inst] = GotoNode(compact.bb_rename_succ[stmt.label])
10021002
result_idx += 1
1003-
elseif isa(stmt, GlobalRef) || isa(stmt, GotoNode)
1003+
elseif isa(stmt, GlobalRef)
1004+
result[result_idx][:inst] = stmt
1005+
result[result_idx][:type] = argextype(stmt, compact)
1006+
result_idx += 1
1007+
elseif isa(stmt, GotoNode)
10041008
result[result_idx][:inst] = stmt
10051009
result_idx += 1
10061010
elseif isa(stmt, GotoIfNot) && compact.cfg_transforms_enabled

test/compiler/inline.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,3 +1069,15 @@ end
10691069
@test fully_eliminated() do
10701070
issue41694(2)
10711071
end
1072+
1073+
global x44200::Int = 0
1074+
function f44200()
1075+
global x = 0
1076+
while x < 10
1077+
x += 1
1078+
end
1079+
x
1080+
end
1081+
let src = code_typed1(f44200)
1082+
@test count(x -> isa(x, Core.PiNode), src.code) == 0
1083+
end

0 commit comments

Comments
 (0)