This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Fix bad PTEST(PTRUE_ALL, PTEST_LIKE) optimization
ClosedPublic

Authored by c-rhodes on Nov 9 2022, 8:03 AM.

Details

Summary

AArch64InstrInfo::optimizePTestInstr attempts to remove a PTEST of a
predicate generating operation that identically sets flags (implictly).

When the mask is an all active of matching element size the PTEST is
currently removed. For while instructions this is correct since they
perform an implicit PTEST with an all active mask. However, for other
instructions such as compares the mask could be different.

This patch fixes this bug by only removing the PTEST if the same all
active mask is used by the predicating-generating instruction.

Diff Detail

Event Timeline

c-rhodes created this revision.Nov 9 2022, 8:03 AM
c-rhodes requested review of this revision.Nov 9 2022, 8:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2022, 8:03 AM
Matt added a subscriber: Matt.Nov 11 2022, 7:27 PM
bsmith accepted this revision.Nov 14 2022, 3:26 AM
bsmith added a subscriber: bsmith.

LGTM

This revision is now accepted and ready to land.Nov 14 2022, 3:26 AM
This revision was landed with ongoing or failed builds.Nov 15 2022, 4:43 AM
This revision was automatically updated to reflect the committed changes.