This is an archive of the discontinued LLVM Phabricator instance.

[SLP]Find reused scalars in buildvector sequences, if any.
ClosedPublic

Authored by ABataev on Mar 21 2023, 2:11 PM.

Details

Summary

Patch generalizes analysis of scalars. The main part is outlined into
lambda, which can be used to find reused inserted scalars and emit
shuffle for them instead of multiple insertelement instructions, if the
permutation is found alreadyi. I.e. some scalars are transformed by the
permutation of previously vectorized nodes, and some are inserted
directly.

Reworked part of D110978

Diff Detail

Event Timeline

ABataev created this revision.Mar 21 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 2:11 PM
ABataev requested review of this revision.Mar 21 2023, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 2:11 PM
RKSimon accepted this revision.Apr 4 2023, 5:12 AM

LGTM

This revision is now accepted and ready to land.Apr 4 2023, 5:12 AM
This revision was automatically updated to reflect the committed changes.

FWIW, this change looks likely to be the blame for a regression I'm seeing on some internal workload at Google, resulting in this failure:

Instruction does not dominate all uses!
  <badref> = extractelement
  %589 = insertelement <4 x float> %588, float <badref>, i64 3
LLVM ERROR: Transformation resulted in an invalid module

I don't have an isolated repro or anything to share at the moment - just a vague "heads up" for now.

This also appears to cause crashes (on a no-assertions build of clang) while compiling skia's skcms.cc file. A reproducer is available on https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.sh https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.cpp (but you'll have to edit the .sh to remove e.g. the loading of a plugin)

FWIW, this change looks likely to be the blame for a regression I'm seeing on some internal workload at Google, resulting in this failure:

Instruction does not dominate all uses!
  <badref> = extractelement
  %589 = insertelement <4 x float> %588, float <badref>, i64 3
LLVM ERROR: Transformation resulted in an invalid module

I don't have an isolated repro or anything to share at the moment - just a vague "heads up" for now.

Please send the reproducer, I'll investigate this ASAP.

This also appears to cause crashes (on a no-assertions build of clang) while compiling skia's skcms.cc file. A reproducer is available on https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.sh https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.cpp (but you'll have to edit the .sh to remove e.g. the loading of a plugin)

Thanks, will fix it ASAP.

This also appears to cause crashes (on a no-assertions build of clang) while compiling skia's skcms.cc file. A reproducer is available on https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.sh https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/Ql60yH5rR8uay4YGhHjjTg/runs/0/artifacts/public/build/skcms-55e1a2.cpp (but you'll have to edit the .sh to remove e.g. the loading of a plugin)

Fixed in cf62adbbd83e593a893a27234636b939870c9658