This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Optimize splats of bitcasted vectors
ClosedPublic

Authored by tlively on May 15 2020, 10:39 AM.

Details

Summary

This new custom DAG combine fixes a codegen issue with the
wasm_simd128.h intrinsics. Clang lowers the

return (v128_t)(__f32x4){__a, __a, __a, __a};

body of f32x4_splat to a splat shuffle of a bitcasted vector, as seen
in the new simd-shuffle-bitcast.ll test. The bitcast interfered with
the target-independent DAG combine that combines splat shuffles into
BUILD_VECTOR nodes, so this patch introduces a new custom DAG combine
to hoist the bitcast out of the shuffle, allowing the
target-independent combine to work as intended.

Diff Detail

Event Timeline

tlively created this revision.May 15 2020, 10:39 AM
dschuff accepted this revision.May 15 2020, 11:27 AM

You know, it's pretty amazing that WebAssemblyISelLowering.cpp is as small as it is.

This revision is now accepted and ready to land.May 15 2020, 11:27 AM
This revision was automatically updated to reflect the committed changes.