Skip to content

Commit a97368d

Browse files
committed
treat anon funcs as opaque functions (instead of throwing)
1 parent bf2a0a6 commit a97368d

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
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.36"
4+
version = "0.12.37"
55

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

src/modeling/graphs.jl

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -971,21 +971,20 @@ end
971971
# end
972972
# instruction(ls::LoopSet, f::Symbol) = instruction!(ls, f)
973973
function instruction!(ls::LoopSet, x::Expr)
974-
# x isa Symbol && return x
975-
if x.head === :$
976-
_x = only(x.args)
977-
_x isa Symbol && return instruction!(ls, _x)
978-
@assert _x isa Expr
979-
x = _x
980-
end
974+
# x isa Symbol && return x
975+
if x.head === :$
976+
_x = only(x.args)
977+
_x isa Symbol && return instruction!(ls, _x)
978+
@assert _x isa Expr
979+
x = _x
980+
end
981+
if x.head :(->)
981982
instr = last(x.args).value
982-
if instr keys(COST)
983-
instr = gensym!(ls, "f")
984-
pushpreamble!(ls, Expr(:(=), instr, x))
985-
Instruction(Symbol(""), instr)
986-
else
987-
Instruction(:LoopVectorization, instr)
988-
end
983+
instr keys(COST) && return Instruction(:LoopVectorization, instr)
984+
end
985+
instr = gensym!(ls, "f")
986+
pushpreamble!(ls, Expr(:(=), instr, x))
987+
Instruction(Symbol(""), instr)
989988
end
990989
instruction!(ls::LoopSet, x::Symbol) = instruction(x)
991990
function instruction!(ls::LoopSet, f::F) where {F <: Function}

test/miscellaneous.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ function findreducedparentfornonvecstoreavx!(U::AbstractMatrix{T}, E1::AbstractV
735735
U[i,j] = t
736736
_s += a * (1 - t^2)
737737
end
738-
E1[j] = _s / n
738+
E1[j] = (x -> x / n)(_s)
739739
end
740740
U,E1
741741
end

0 commit comments

Comments
 (0)