This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix ISel crash on sext_inreg/extract type mismatch
ClosedPublic

Authored by tlively on May 29 2019, 10:10 PM.

Details

Summary

Adjusts the index and adds a bitcast around the vector operand of
EXTRACT_VECTOR_ELT so that its lane type matches the source type of
its parent sext_inreg. Without this bitcast the ISel patterns do not
match and ISel fails.

Diff Detail

Repository
rL LLVM

Event Timeline

tlively created this revision.May 29 2019, 10:10 PM
tlively updated this revision to Diff 202260.May 30 2019, 11:42 AM
  • Add assert that the index adjustment is reasonable
aheejin accepted this revision.May 30 2019, 8:09 PM
aheejin added inline comments.
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
1229 ↗(On Diff #202260)

As we talked offline, this does not seem to do any casts, because Extract.getOperand(0)'s type should be VecT in the first place.

This revision is now accepted and ready to land.May 30 2019, 8:09 PM
aheejin requested changes to this revision.May 30 2019, 8:10 PM

Oh, I accidentally accepted the CL, sorry. Will change to Request Changes instead. (It looks there's no option of 'cancelling' the acceptance.)

This revision now requires changes to proceed.May 30 2019, 8:10 PM
tlively updated this revision to Diff 202528.May 31 2019, 8:42 PM
  • Fix Bitcast and update test to be more convincing of correctness

@aheejin, this should be good to go now. Changing the test to use a real pointer instead of undef seems to have made it do the correct number of loads (32 bits, where before it was only loading 8 bits). Now that the test is very straightforward I am confident in the correctness of the code, so hopefully this should be good to land.

aheejin accepted this revision.Jun 3 2019, 6:23 PM

LGTM

This revision is now accepted and ready to land.Jun 3 2019, 6:23 PM
This revision was automatically updated to reflect the committed changes.