This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Fix the crash on cost calculation if non-compatible vectors shuffled.
ClosedPublic

Authored by ABataev on Apr 28 2021, 11:14 AM.

Details

Summary

If the extracts from the non-power-2 vectors are recognized as shuffles,
need some extra checks to not crash cost calculations if trying to gext
the ecost for subvector extracts. In this case need to check carefully
that we do not exit out of bounds of the original vector, otherwise the
TTI's cost model will crash on assert.

Diff Detail

Event Timeline

ABataev created this revision.Apr 28 2021, 11:14 AM
ABataev requested review of this revision.Apr 28 2021, 11:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2021, 11:14 AM
spatel added inline comments.Apr 30 2021, 8:02 AM
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
3600–3601

This could use a comment or a code example to explain. I can't tell just from looking at this what the new SubVT represents.

llvm/test/Transforms/SLPVectorizer/AMDGPU/add_sub_sat.ll
226 ↗(On Diff #341272)

Add a new test instead of changing the existing test?
IIUC, it's not the "GFX7" run that is crashing, but we don't have any check lines for "GFX8"? It would be better to just create a new file without "-instcombine", so we can see exactly what SLP will create on this test.

ABataev updated this revision to Diff 341928.Apr 30 2021, 8:44 AM

Rebase + fixes

ABataev marked an inline comment as done.Apr 30 2021, 8:45 AM
ABataev added inline comments.
llvm/test/Transforms/SLPVectorizer/AMDGPU/add_sub_sat.ll
226 ↗(On Diff #341272)

Done, thanks and sorry for the mess with the previous test

spatel accepted this revision.Apr 30 2021, 9:33 AM

LGTM

This revision is now accepted and ready to land.Apr 30 2021, 9:33 AM
This revision was landed with ongoing or failed builds.Apr 30 2021, 9:52 AM
This revision was automatically updated to reflect the committed changes.
ABataev marked an inline comment as done.