This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Remove SETCC of CSEL when the latter's condition can be inverted
ClosedPublic

Authored by bsmith on May 27 2021, 8:02 AM.

Details

Summary
setcc (csel 0, 1, cond, X), 1, ne ==> csel 0, 1, !cond, X

Where X is a condition code setting instruction.

Co-authored-by: Paul Walker <paul.walker@arm.com>

Diff Detail

Event Timeline

bsmith created this revision.May 27 2021, 8:02 AM
bsmith requested review of this revision.May 27 2021, 8:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2021, 8:02 AM
Matt added a subscriber: Matt.May 28 2021, 1:29 PM
joechrisellis accepted this revision.Jun 3 2021, 8:09 AM

LGTM, one small suggestion.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
15383–15386

Untested, but you might be able to simplify this a little bit with LLVM's pattern matching functionality. See: https://llvm.org/doxygen/PatternMatch_8h_source.html.

It might not work, though. If not I'm fine with this. 😄

This revision is now accepted and ready to land.Jun 3 2021, 8:09 AM

Apologies @bsmith, ignore my last comment. The pattern matching stuff is only for IR -- I had mistakenly thought that it could be used in this context, but it can't. Sorry! 😅

This revision was landed with ongoing or failed builds.Jun 4 2021, 8:01 AM
This revision was automatically updated to reflect the committed changes.