This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Allow SimplifyDemandedVectorElts to look through freeze
Needs ReviewPublic

Authored by foad on Jul 14 2023, 7:37 AM.

Details

Reviewers
nikic
ManuelJBrito
nlopes
Group Reviewers
Restricted Project

Diff Detail

Event Timeline

foad created this revision.Jul 14 2023, 7:37 AM
foad requested review of this revision.Jul 14 2023, 7:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 7:37 AM

I think this is legal, but I believe we need to preserve the current results in shufflevector_freezepoison.ll -- it's a pattern we try to intentionally preserve to the backend.

foad added a comment.Jul 14 2023, 9:04 AM

I think this is legal, but I believe we need to preserve the current results in shufflevector_freezepoison.ll -- it's a pattern we try to intentionally preserve to the backend.

I don't understand the bigger picture here. Why do we ever combine "freeze poison" into undef? In which cases do we not want to do that?

nlopes added inline comments.Jul 14 2023, 10:48 AM
llvm/test/Transforms/InstCombine/shufflevector_freezepoison.ll
17

this transformation isn't correct.
It replaces <a[0], a[1], freeze poison, freeze poison>
with: <a[0], a[1], poison, poison>.

OOB or poison indexes in the mask yield a poison element.

Not sure if the bug is in this patch or if it was already there though. The code needs probably needs to separate undef from poison elements.