[PATCH] D130508: [RISCV] Teach translateSetCCForBranch to help improve constant materialization.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 12:05:06 PDT 2022


craig.topper created this revision.
craig.topper added reviewers: reames, luismarques, asb.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, 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, kristof.beyls, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

InstCombine and DAGCombine both canonicalize setge X, C to
setgt X, C-1. C might be easier to materialize than C.

This patch teaches translateSetCCForBranch to reverse the canonicalize
if it will give us a single 'addi' or 'lui' to materialize the constant.

This was inspired by https://github.com/llvm/llvm-project/issues/56666
and wondering if we should do something like getAArch64Cmp.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130508

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rv32zbt.ll
  llvm/test/CodeGen/RISCV/rv64zbt.ll
  llvm/test/CodeGen/RISCV/select-cc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130508.447426.patch
Type: text/x-patch
Size: 4585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220725/d0be48f7/attachment.bin>


More information about the llvm-commits mailing list