[PATCH] D122208: [RISCV] Optimize (select Cond, X, 0) --> and (sext Cond), X

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 20:51:34 PDT 2022


StephenFan created this revision.
StephenFan added reviewers: craig.topper, frasercrmck, jrtc27, asb.
Herald added subscribers: s, VincentWu, luke957, armkevincheng, eric-k256, vkmr, evandro, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a reviewer: sjarus.
Herald added a project: All.
StephenFan requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

Add target dependent DAG combine for select node. The optimization is transform
`select Cond, X, 0` to `and (sext Cond), X`. For RISCV, this optimization can decrease 
code size. Other Arch(like X86) seems not. So I didn't add this optimization to generic
DAG Combine.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122208

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/alu64.ll
  llvm/test/CodeGen/RISCV/fpclamptosat.ll
  llvm/test/CodeGen/RISCV/fpclamptosat_vec.ll
  llvm/test/CodeGen/RISCV/selectcc-to-shiftand.ll
  llvm/test/CodeGen/RISCV/shifts.ll
  llvm/test/CodeGen/RISCV/vec3-setcc-crash.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122208.417177.patch
Type: text/x-patch
Size: 168398 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220322/af1b29af/attachment.bin>


More information about the llvm-commits mailing list