Skip to content

Commit

Permalink
Allow more sizes for using LLVM vector for a tuple, but not
Browse files Browse the repository at this point in the history
those that cause LLVM 3.7 assertion failures.
  • Loading branch information
Arch D. Robison committed Apr 7, 2016
1 parent 2f8f010 commit 5230671
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ static void set_struct_decl(jl_datatype_t *jst) {
if (isvector && lasttype != T_int1 && !type_is_ghost(lasttype)) {
// Homogeneous tuple
// TODO: currently we get LLVM assertion failures for other vector sizes
bool validVectorSize = (ntypes == 2 || ntypes == 4 || ntypes == 8 || ntypes == 16);
bool validVectorSize = ntypes<=16 && (1<<ntypes & 0xE880) == 0;
if (lasttype->isSingleValueType() && !lasttype->isVectorTy() && validVectorSize && is_vecelement_type(jl_svecref(jst->types,0)))
jst->struct_decl = VectorType::get(lasttype, ntypes);
else
Expand Down
9 changes: 4 additions & 5 deletions test/vecelement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ function call_iota(N)
@test x[1].value+x[N].value === 3+3*N
end

call_iota(2)
call_iota(4)
call_iota(7) # try non-power of two
call_iota(8)
call_iota(16)
# Try various tuple lengths
for i=1:20
call_iota(i)
end

# Another crash report for #15244 motivated this test.
immutable Bunch{N,T}
Expand Down

0 comments on commit 5230671

Please sign in to comment.