This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix crash trying to generate i1 immediates
ClosedPublic

Authored by dmgreen on Jun 15 2020, 11:28 AM.

Details

Summary

These code patterns attempt to call isVMOVModifiedImm on a splat of i1 values, leading to an unreachable being hit. I've guarded the call on a more specific set of sizes, as i1 is legal under MVE.

Diff Detail

Event Timeline

dmgreen created this revision.Jun 15 2020, 11:28 AM
dmgreen retitled this revision from [ARM] Fix crash trying to general i1 immediates to [ARM] Fix crash trying to generate i1 immediates.Jun 15 2020, 11:29 AM
This revision is now accepted and ready to land.Jun 16 2020, 1:18 AM
This revision was automatically updated to reflect the committed changes.
uabelho added inline comments.
llvm/test/CodeGen/Thumb2/mve-vmovimm.ll
549

Hi!
I've no idea if this might be a real problem or not, but I noticed when I ran this testcase that we end up in this code in BuildVectorSDNode::isConstantSplat (SelectionDAG.cpp line 9660):

// FIXME: This does not work for vectors with elements less than 8 bits.
while (VecWidth > 8) {
  unsigned HalfSize = VecWidth / 2;

with VT being v4i1. VecWidth is 4 so the loop won't do anything in this case.
At least according to the FIXME it doesn't seem good, but perhaps the comment is overly cautious.
(I just thought I'd share this since in our downstream clone we have an assert there that suddenly failed on this testcase.)

Thanks for the info! That does sound like something that's worth avoiding. I'll try and change things around so that it never gets called on an i1 vector.