This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Fold G_XOR x, -1 into G_SELECT and select CSINV
ClosedPublic

Authored by paquette on Nov 4 2020, 10:17 AM.

Details

Summary

When we see

xor = G_XOR xor_lhs, -1
select = G_SELECT cc, tval, xor

Fold this into

select = CSINV tval, xor_lhs, cc

Update select-select.mir to reflect the changes.

For now, only handle the case where the G_XOR is the false-value for the G_SELECT. It may make more sense to handle the true-value case in post-legalizer lowering.

Diff Detail

Event Timeline

paquette created this revision.Nov 4 2020, 10:17 AM

Maybe use PatternMatch for this too?

paquette updated this revision to Diff 305263.Nov 13 2020, 2:11 PM

Rebase + use new m_Not matcher

aemerson accepted this revision.Nov 13 2020, 10:38 PM
This revision is now accepted and ready to land.Nov 13 2020, 10:38 PM