[PATCH] D107603: Fold (add (select lhs, rhs, cc, 0, y), x) -> (select lhs, rhs, cc, x, (add x, y))

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 14:50:18 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: asb, luismarques, khchen, arcbbb, evandro, jrtc27, frasercrmck, HsiangKai.
Herald added subscribers: StephenFan, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

Similar for sub except sub isn't commutative.

Modify the existing and/or/xor folds to also work on ISD::SELECT
and not just RISCVISD::SELECT_CC. This is needed to make sure
we do this transform before type legalization turns i32 add/sub
into add/sub+sign_extend_inreg on RV64. If we don't do this before
that, the sign_extend_inreg will still be after the select.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107603

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107603.364622.patch
Type: text/x-patch
Size: 12267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210805/e69cda7a/attachment.bin>


More information about the llvm-commits mailing list