This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Optimize compare and branch cases with G_INTTOPTR and unknown values
ClosedPublic

Authored by aemerson on Jul 8 2019, 4:09 PM.

Details

Summary

Since we have distinct types for pointers and scalars, G_INTTOPTRs can sometimes obstruct attempts to find constant source values. These usually come about when try to do some kind of null pointer check. Teaching getConstantVRegValWithLookThrough about this operation allows the CBZ/CBNZ optimization to catch more cases.

This change also improves the case where we can't find a constant source at all. Previously we would emit a cmp, cset and tbnz for that. Now we try to just emit a cmp and conditional branch, saving an instruction.

The cumulative code size improvement of this change plus D64354 is 5.5% geomean on arm64 CTMark -O0.

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Jul 8 2019, 4:09 PM
paquette accepted this revision.Jul 9 2019, 5:34 PM

LGTM

This revision is now accepted and ready to land.Jul 9 2019, 5:34 PM
This revision was automatically updated to reflect the committed changes.