|
244 | 244 |
|
245 | 245 | includesarray(ls::LoopSet, array::Symbol) = array ∈ ls.includedarrays |
246 | 246 |
|
247 | | -function LoopSet(mod::Symbol, W = Symbol("##Wvecwidth##"), T = Symbol("Tloopeltype"))# = :LoopVectorization) |
| 247 | +function LoopSet(mod::Symbol, W = Symbol("##Wvecwidth##"), T = Symbol("##Tloopeltype##"))# = :LoopVectorization) |
248 | 248 | LoopSet( |
249 | 249 | Symbol[], [0], Loop[], |
250 | 250 | Dict{Symbol,Operation}(), |
|
332 | 332 | function add_block!(ls::LoopSet, ex::Expr, elementbytes::Int, position::Int) |
333 | 333 | for x ∈ ex.args |
334 | 334 | x isa Expr || continue # be that general? |
| 335 | + x.head === :inbounds && continue |
335 | 336 | push!(ls, x, elementbytes, position) |
336 | 337 | end |
337 | 338 | end |
@@ -546,6 +547,18 @@ function Base.push!(ls::LoopSet, ex::Expr, elementbytes::Int, position::Int) |
546 | 547 | add_andblock!(ls, ex, elementbytes, position) |
547 | 548 | elseif ex.head === :|| |
548 | 549 | add_orblock!(ls, ex, elementbytes, position) |
| 550 | + elseif ex.head === :local # Handle locals introduced by `@inbounds`; using `local` with `@avx` is not recomended (nor is `@inbounds`; which applies automatically regardless) |
| 551 | + @assert length(ex.args) == 1 # TODO replace assert + first with "only" once support for Julia < 1.4 is dropped |
| 552 | + localbody = first(ex.args) |
| 553 | + @assert localbody.head === :(=) |
| 554 | + @assert length(localbody.args) == 2 |
| 555 | + LHS = (localbody.args[1])::Symbol |
| 556 | + RHS = push!(ls, (localbody.args[2]), elementbytes, position) |
| 557 | + if isstore(RHS) |
| 558 | + RHS |
| 559 | + else |
| 560 | + add_compute!(ls, LHS, :identity, [RHS], elementbytes) |
| 561 | + end |
549 | 562 | else |
550 | 563 | throw("Don't know how to handle expression:\n$ex") |
551 | 564 | end |
|
0 commit comments