This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Stop isInterleaveShuffle from producing illegal extract_subvectors.
ClosedPublic

Authored by craig.topper on Jun 20 2023, 3:15 PM.

Details

Summary

The definition for ISD::EXTRACT_SUBVECTOR says the index must be
aligned to the known minimum elements of the extracted type. We mostly
got away with this but it turns out there are places that depend on this.

For example, this code in getNode for ISD::EXTRACT_SUBVECTOR

// EXTRACT_SUBVECTOR of CONCAT_VECTOR can be simplified if the pieces of
// the concat have the same type as the extract.
if (N1.getOpcode() == ISD::CONCAT_VECTORS && N1.getNumOperands() > 0 &&
    VT == N1.getOperand(0).getValueType()) {
  unsigned Factor = VT.getVectorMinNumElements();
  return N1.getOperand(N2C->getZExtValue() / Factor);
}

This depends on N2C->getZExtValue() being evenly divisible by Factor.

Diff Detail

Event Timeline

craig.topper created this revision.Jun 20 2023, 3:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2023, 3:15 PM
craig.topper requested review of this revision.Jun 20 2023, 3:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2023, 3:15 PM

Fix typo in comment

luke accepted this revision.Jun 21 2023, 4:03 AM

LGTM

This revision is now accepted and ready to land.Jun 21 2023, 4:03 AM