[PATCH] D149166: [RISCV] Try to perform select => binop combines when conditional operations are available

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 10:08:06 PDT 2023


asb created this revision.
asb added reviewers: craig.topper, reames.
Herald added subscribers: jobnoorman, luke, wingo, pmatos, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, steven.zhang, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
asb requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

When condops aren't available, these transformations are performed in lowerSELECT or in a DAGCombine on RISCVISD::SELECT_CC. This patch performs the first two of these combines, which are unconditionally profitable when conditional operations are enabled.

I'm posting this for comment on the general approach of performing this transformation as a dagcombine on select, and get feedback on the desirability of performing it even when condops aren't available (right now it causes a slight regression in a couple of the tests in min-max.ll). There are obviously a number of other condops related regressions, but this seemed like a relatively easily separable initial step. I'll also note that it's not possible to remove this transformation from lowerSELECT (and just rely on the ISD::SELECT combine) without causing codegen regressions, because a select might be produced through legalisation and lowered before the dag combiner runs again.


https://reviews.llvm.org/D149166

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/select-binop-identity.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149166.516832.patch
Type: text/x-patch
Size: 4381 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/df5df32b/attachment.bin>


More information about the llvm-commits mailing list