This is an archive of the discontinued LLVM Phabricator instance.

[WASM] Fix legalizer for LowerBUILD_VECTOR.
ClosedPublic

Authored by Peter on Mar 30 2023, 1:44 AM.

Details

Summary

Constants in BUILD_VECTOR may be down cast into a smaller value that fits LaneBits, i.e., the bit width of elements in the vector.
This cast didn't consider 2^N where it would be cast into -2^N, which still doesn't fit into LaneBits after casting.
This will cause an assertion in later legalization.

2^N should be cast into 0, and this patch reflects such behavior.
This patch also includes a test to reflect the fix.
This patch fixes issue 61780

Related patch: https://reviews.llvm.org/D108669

Diff Detail

Event Timeline

Peter created this revision.Mar 30 2023, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 1:44 AM
Peter requested review of this revision.Mar 30 2023, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 1:44 AM
Peter edited the summary of this revision. (Show Details)Mar 30 2023, 1:45 AM
Peter added reviewers: tlively, dschuff.
Peter updated this revision to Diff 509575.Mar 30 2023, 1:48 AM

update test with FileCheck

tlively accepted this revision.Mar 30 2023, 8:04 AM

Thanks for the fix!

This revision is now accepted and ready to land.Mar 30 2023, 8:04 AM
This revision was automatically updated to reflect the committed changes.