[all-commits] [llvm/llvm-project] b604fc: [runtime] Move prolog/epilog block to a post-simpl...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Aug 31 09:31:18 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b604fcb7bc9c4c3bf15479c8406eb69f582fb71b
      https://github.com/llvm/llvm-project/commit/b604fcb7bc9c4c3bf15479c8406eb69f582fb71b
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

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

  Log Message:
  -----------
  [runtime] Move prolog/epilog block to a post-simplify strategy

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.

Differential Revision: https://reviews.llvm.org/D108521




More information about the All-commits mailing list