This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Update instcombine for vectorOps to use new shufflevector semantics
ClosedPublic

Authored by ManuelJBrito on May 6 2023, 6:43 AM.

Details

Summary

This patch updates the transformations in InstCombineVectorOps to use the new shufflevector semantics that say that undefined values in the mask yield poison.

To prevent miscompilations we have to match with m_Poison instead of m_Undef. Otherwise, we might introduce poison where there was previously undef.

Diff Detail

Event Timeline

ManuelJBrito created this revision.May 6 2023, 6:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2023, 6:43 AM
ManuelJBrito requested review of this revision.May 6 2023, 6:43 AM
nlopes accepted this revision.May 7 2023, 5:05 AM

LGTM, thanks!

This revision is now accepted and ready to land.May 7 2023, 5:05 AM
nikic added inline comments.May 7 2023, 12:02 PM
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
1263

I don't understand what is going on in this conditional. Why do we need the undef check here? We already checked above that either the base operand is poison or all elements are present.

ManuelJBrito added inline comments.May 7 2023, 1:29 PM
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
1263

Yes you are correct. It's redundant. Thanks !

Remove redundant check

nikic accepted this revision.May 16 2023, 11:07 AM

LGTM

This revision was landed with ongoing or failed builds.May 16 2023, 11:58 PM
This revision was automatically updated to reflect the committed changes.