Skip to content

Commit 2548cef

Browse files
committed
adjust a test so that it would fail without the preceding commit
1 parent 26d30bc commit 2548cef

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/parse/add_constants.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,27 @@ function ensure_constant_lowered!(ls::LoopSet, mpref::ArrayReferenceMetaPosition
101101
end
102102
function add_constant_vload!(ls::LoopSet, op::Operation, mpref::ArrayReferenceMetaPosition, elementbytes::Int)
103103
temp = gensym!(ls, "intermediateconstref")
104-
vloadcall = Expr(:call, lv(:_vload), mpref.mref.ptr)
104+
use_getindex = vptr(name(mpref)) === mpref.mref.ptr
105+
vloadcall = use_getindex ? Expr(:call, Base.getindex, name(mpref)) : Expr(:call, lv(:_vload), mpref.mref.ptr)
105106
nindices = length(getindices(op))
106107
# getoffsets(op) .+= 1
107108
if nindices > 0
108109
dummyloop = first(ls.loops)
109110
for ind getindicesonly(op)
110111
ensure_constant_lowered!(ls, mpref, ind)
111112
end
112-
push!(vloadcall.args, mem_offset(op, UnrollArgs(dummyloop, dummyloop, dummyloop, 0, 0, 0), fill(false,nindices), true, ls, false))
113+
if use_getindex
114+
append!(vloadcall.args, mem_offset(op, UnrollArgs(dummyloop, dummyloop, dummyloop, 0, 0, 0), fill(false,nindices), true, ls, false).args)
115+
else
116+
push!(vloadcall.args, mem_offset(op, UnrollArgs(dummyloop, dummyloop, dummyloop, 0, 0, 0), fill(false,nindices), true, ls, false))
117+
end
118+
end
119+
if use_getindex
120+
pushpreamble!(ls, Expr(:(=), temp, :(@inbounds $vloadcall)))
121+
else
122+
push!(vloadcall.args, Expr(:call, lv(:False)), staticexpr(reg_size(ls)))
123+
pushpreamble!(ls, Expr(:(=), temp, vloadcall))
113124
end
114-
push!(vloadcall.args, Expr(:call, lv(:False)), staticexpr(reg_size(ls)))
115-
pushpreamble!(ls, Expr(:(=), temp, vloadcall))
116125
pushpreamble!(ls, Expr(:(=), name(op), temp))
117126
pushpreamble!(ls, op, temp)
118127
return temp

0 commit comments

Comments
 (0)