Skip to content

Commit c1e0f42

Browse files
committed
fix issue #407
1 parent 88e8f46 commit c1e0f42

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.113"
4+
version = "0.12.114"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/parse/memory_ops_common.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,11 @@ function array_reference_meta!(
894894
move_to_last!(offsets, ind_prev_index)
895895
move_to_last!(strides, ind_prev_index)
896896
move_to_last!(loopedindex, ind_prev_index)
897-
move_to_last!(loopdependencies, ind_prev_index)
897+
if length(loopdependencies) == length(indices)
898+
move_to_last!(loopdependencies, ind_prev_index)
899+
else
900+
move_to_last!(loopdependencies, findfirst(Base.Fix2(===, ind), loopdependencies)::Int)
901+
end
898902
vptrarray = repeated_index!(
899903
ls,
900904
indices,

test/simplemisc.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
1+
import LinearAlgebra
2+
function issue407!(Hdata::Matrix{Complex{T}}) where {T}
3+
Hview=reinterpret(reshape,T,Hdata)
4+
@tturbo for i in 1:size(Hdata,1)
5+
Hview[1, i, i] = i
6+
end
7+
end
28
function lv_turbo(r::Vector{UInt64}, mask::UInt64)
39
@turbo for i = 1:length(r)
410
r[i] &= mask
@@ -13,3 +19,10 @@ end
1319
r2 = r1 .& mask
1420
@test lv_turbo(r1, mask) == r2
1521
end
22+
@testset "issue 407" begin
23+
@show @__LINE__
24+
A = zeros(Complex{Float64}, 10, 10);
25+
issue407!(A)
26+
@test real.(A) == Diagonal(1:10)
27+
@test all(iszero, imag.(A))
28+
end

0 commit comments

Comments
 (0)