[PATCH] D108521: [runtime] Move prolog/epilog block to a post-simplify strategy

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 22 13:12:23 PDT 2021


reames created this revision.
reames added reviewers: fhahn, nikic, annatom.
Herald added subscribers: zzheng, bollu, hiraditya, nemanjai, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

The runtime unroller will try to produce a non-loop if the unroll count is 2 and thus the prolog/epilog loop would only run at most one iteration.  The old implementation did this by avoiding loop construction entirely.  This patches instead constructs the trivial loop and then explicitly breaks the backedge and simplifies.  This does result in some additional code churn when triggered, but a) results in better quality code and b) removes a codepath which didn't work properly for multiple exit epilogs.

One oddity that I want to draw to reviewer attention is that this somehow changes revisit order.  The new order looks equivalent to me, but I don't understand how creating and erasing an extra loop here creates this effect.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108521

Files:
  llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors-inseltpoison.ll
  llvm/test/Transforms/LoopUnroll/PowerPC/p8-unrolling-legalize-vectors.ll
  llvm/test/Transforms/LoopUnroll/revisit.ll
  llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll
  llvm/test/Transforms/LoopUnroll/runtime-loop1.ll
  llvm/test/Transforms/LoopUnroll/runtime-unroll-assume-no-remainder.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108521.367996.patch
Type: text/x-patch
Size: 79234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210822/0e9847ae/attachment.bin>


More information about the llvm-commits mailing list