This is an archive of the discontinued LLVM Phabricator instance.

[SLP] Cleanup: Remove loop around `tryToVectorizeSequence` of PHIs.
Needs ReviewPublic

Authored by vporpo on Apr 21 2023, 3:08 PM.

Details

Reviewers
ABataev
Summary

I think that the loop is not needed.
I added an assertion to check whether a second iteration succeeds in
vectorizing phi noeds, but it never caused a crash.
Anyway, if this is actually used, we don't have a test for it.

Diff Detail

Event Timeline

vporpo created this revision.Apr 21 2023, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 3:08 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vporpo requested review of this revision.Apr 21 2023, 3:08 PM

Do not forget that instructions can mutate during vectorization and if at the first iteration they are not compatible, they might be transformed into extractelement instructions on this first iteration, and become compatible on the second one

So the purpose of this loop is to attempt to vectorize the same PHI seeds that failed previously because the code might have changed in the meantime. But is this something that should be done specifically for PHI nodes? Perhaps we should be doing this for other seed types too ?

So the purpose of this loop is to attempt to vectorize the same PHI seeds that failed previously because the code might have changed in the meantime. But is this something that should be done specifically for PHI nodes? Perhaps we should be doing this for other seed types too ?

Generally speaking, yes.

Since this is not a complete feature and we don't have any tests for it, shouldn't we remove it and add it again if needed ? Wdyt?

Since this is not a complete feature and we don't have any tests for it, shouldn't we remove it and add it again if needed ? Wdyt?

Why not complete? Removing this may affect vectorization. If you mean to the test, I can try to add it.

Why not complete? Removing this may affect vectorization. If you mean to the test, I can try to add it.

It is not complete in the sense that this is just for PHIs and is not supported for other seeds.

It just seems to me that this shouldn't have too much impact, and it is better to have the same logic for all seed types. If we really need this feature we should either enable it for all or completely remove it.

Why not complete? Removing this may affect vectorization. If you mean to the test, I can try to add it.

It is not complete in the sense that this is just for PHIs and is not supported for other seeds.

It just seems to me that this shouldn't have too much impact, and it is better to have the same logic for all seed types. If we really need this feature we should either enable it for all or completely remove it.

The fact that it is not ready for other seeds, does not make it non-important for PHIs.