[PATCH] D129793: [LSR] Allow already invariant operand for ICmpZero matching

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 11:48:49 PDT 2022


reames created this revision.
reames added reviewers: fhahn, nikic.
Herald added subscribers: frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, javed.absar, zzheng, jrtc27, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, asb, hiraditya, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: pcwang-thead, MaskRay.
Herald added a project: LLVM.

The ICmpZero matching is checking to see if the expression is loop invariant per SCEV and expandable.  This allows expressions inside the loop which can be made loop invariant to be seamlessly expanded, but is overly conservative for expressions which already *are* loop invariant.

As a simple justification for why this is correct, consider a loop invariant urem as RHS vs an alternate function with that same urem wrapped inside a helper call.  Why would it be legal to match the later, but not the former?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129793

Files:
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
  llvm/test/Transforms/LoopStrengthReduce/RISCV/icmp-zero.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129793.444750.patch
Type: text/x-patch
Size: 53990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/e95207ad/attachment.bin>


More information about the llvm-commits mailing list