This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Optimize G_FCMP + G_SELECT pairs when G_SELECT is fp
ClosedPublic

Authored by paquette on May 30 2019, 12:01 PM.

Details

Summary

Instead of emitting all of the test stuff for a compare when it's only used by a select, instead, just emit the compare + select. The select will use the value of NZCV correctly, so we don't need to emit all of the test instructions etc.

For now, only support fp selects which use G_FCMP. Also only support condition codes which will only require one select to represent.

Also add a test.

Diff Detail

Repository
rL LLVM

Event Timeline

paquette created this revision.May 30 2019, 12:01 PM
aemerson added inline comments.May 30 2019, 3:08 PM
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
2826 ↗(On Diff #202267)

This could do with a bit of documentation showing what we're trying to match and generate.

2863 ↗(On Diff #202267)

Can remove this delete comment because we're not explicitly deleting anything here.

paquette updated this revision to Diff 202318.May 30 2019, 3:23 PM
paquette marked 2 inline comments as done.

Remove incorrect/outdated comment, and add a description of what tryOptSelect is trying to do.

This revision is now accepted and ready to land.May 31 2019, 12:39 PM
This revision was automatically updated to reflect the committed changes.
phosek added a subscriber: phosek.Jun 4 2019, 8:24 PM

This seems to have introduced PR42129.

phosek added a comment.Jun 5 2019, 1:49 PM

This seems to have introduced PR42129.

This is causing all our builders to fail with ICE so I'm going to revert this change.

This seems to have introduced PR42129.

This is causing all our builders to fail with ICE so I'm going to revert this change.

Jessica's unavailable so I'll take a look at this. Go ahead and revert in the mean time.

Thanks,
Amara

Re-applied in r362666 with a fix. Thanks for reporting it.