This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Fix PR58863: Mask index beyond mask size for non-power-2 insertelement analysis.
ClosedPublic

Authored by ABataev on Nov 8 2022, 6:19 AM.

Details

Summary

Need to check if the insertelement mask size is reached during cost analysis to avoid compiler crash.

Diff Detail

Event Timeline

ABataev created this revision.Nov 8 2022, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 6:19 AM
ABataev requested review of this revision.Nov 8 2022, 6:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 6:19 AM
RKSimon added inline comments.Nov 8 2022, 6:59 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
6705–6706

Is this any better?

Mask[I] = ((I >= InMask.size()) || InMask.test(I)) ? UndefMaskElem : I;
ABataev updated this revision to Diff 473994.Nov 8 2022, 7:06 AM

Address comment

RKSimon accepted this revision.Nov 8 2022, 7:46 AM

LGTM

This revision is now accepted and ready to land.Nov 8 2022, 7:46 AM