Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/spirv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,9 @@ end
# indices than the field it is looking for, silently dropping the store of that field.
# e.g., storing `(flag::Bool, (a, b))` built by inserting `flag`, `a` and `b`, loses `flag`
# (intel/intel-graphics-compiler#378, JuliaGPU/OpenCL.jl#502, JuliaGPU/oneAPI.jl#259).
# this needs to run after optimization, as InstCombine folds these sequences back together.
# this runs after optimization, where SROA introduces these `insertvalue`s when splitting
# aggregate loads. the InstCombine run in `prepare_execution!` doesn't reconstruct them
# from the flattened form.
function flatten_nested_insertvalue!(mod::LLVM.Module)
changed = false
@tracepoint "flatten nested insertvalue" begin
Expand Down
8 changes: 8 additions & 0 deletions test/spirv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ end
@check "insertvalue {{.*}}, 1"
SPIRV.code_llvm(mod.kernel, tt; backend, driver=:intel)
end

# the flattened form must survive the passes that run between `finish_ir!` and the
# back end (`prepare_execution!` runs InstCombine)
@test @filecheck begin
@check "OpFunction"
@check_not "OpCompositeInsert {{.*}} {{[0-9]+}} {{[0-9]+}}{{\$}}"
SPIRV.code_native(mod.kernel, tt; backend, driver=:intel)
end
end

############################################################################################
Expand Down
Loading