[PATCH] D108114: [LoopPeel] Peel if it turns invariant loads dereferenceable.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 03:36:15 PDT 2021


fhahn created this revision.
fhahn added reviewers: reames, efriedma, skatkov, mkazantsev.
Herald added subscribers: jfb, zzheng, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

This patch adds a new cost heuristic that allows peeling a single
iteration off multi-exit read-only loops, if they contain loop-invariant
loads that dominate the latch. If all non-latch exits are terminated
with unreachable, the invariant loads in the loop are guaranteed to be
dereferenceable, enabling hoisting/CSE'ing them.

This enables vectorization of loops with certain runtime-checks, like
multiple calls to `std::vector::at`.

This should give a 20-30% improvement in score of Geekbench5/HDR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108114

Files:
  llvm/include/llvm/Transforms/Utils/LoopPeel.h
  llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
  llvm/lib/Transforms/Utils/LoopPeel.cpp
  llvm/test/Transforms/LoopUnroll/peel-to-turn-invariant-accesses-dereferenceable.ll
  llvm/test/Transforms/PhaseOrdering/AArch64/peel-multiple-unreachable-exits-for-vectorization.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108114.366580.patch
Type: text/x-patch
Size: 27732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210816/25c4ae40/attachment.bin>


More information about the llvm-commits mailing list