Skip to content

Commit

Permalink
[GCLowering] Fix type condition to include vector of pointers
Browse files Browse the repository at this point in the history
Fixes #28445
  • Loading branch information
Keno committed Aug 5, 2018
1 parent 5d43217 commit e5d88a3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ void LateLowerGCFrame::NoteUse(State &S, BBState &BBS, Value *V, BitVector &Uses
void LateLowerGCFrame::NoteOperandUses(State &S, BBState &BBS, User &UI, BitVector &Uses) {
for (Use &U : UI.operands()) {
Value *V = U;
if (!isSpecialPtr(V->getType()))
if (!isSpecialPtr(V->getType()) && !isSpecialPtrVec(V->getType()))
continue;
NoteUse(S, BBS, V, Uses);
}
Expand Down
20 changes: 20 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6675,3 +6675,23 @@ c28399 = 42
@test g28399(0)() == 42
@test g28399(1)() == 42
@test_throws UndefVarError(:__undef_28399__) f28399()

# issue #28445
mutable struct foo28445
x::Int
end

@noinline make_foo28445() = (foo28445(1), foo28445(rand(1:10)), foo28445(rand(1:10)))
@noinline function use_tuple28445(c)
@test isa(c[2], foo28445)
@test isa(c[3], foo28445)
end

function repackage28445()
(_, a, b) = make_foo28445()
GC.gc()
c = (foo28445(1), foo28445(2), a, b)
use_tuple28445(c)
true
end
@test repackage28445()
13 changes: 13 additions & 0 deletions test/llvmpasses/gcroots.ll
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,19 @@ top:
ret i8 %val
}

define %jl_value_t addrspace(10)* @vecstoreload(<2 x %jl_value_t addrspace(10)*> *%arg) {
; CHECK-LABEL: @vecstoreload
; CHECK: %gcframe = alloca %jl_value_t addrspace(10)*, i32 4
top:
%ptls = call %jl_value_t*** @julia.ptls_states()
%loaded = load <2 x %jl_value_t addrspace(10)*>, <2 x %jl_value_t addrspace(10)*> *%arg
call void @jl_safepoint()
%obj = call %jl_value_t addrspace(10) *@alloc()
%casted = bitcast %jl_value_t addrspace(10)* %obj to <2 x %jl_value_t addrspace(10)*> addrspace(10)*
store <2 x %jl_value_t addrspace(10)*> %loaded, <2 x %jl_value_t addrspace(10)*> addrspace(10)* %casted
ret %jl_value_t addrspace(10)* %obj
}

!0 = !{!"jtbaa"}
!1 = !{!"jtbaa_const", !0, i64 0}
!2 = !{!1, !1, i64 0, i64 1}

0 comments on commit e5d88a3

Please sign in to comment.