[all-commits] [llvm/llvm-project] b9808e: [LoopUnroll] Fold add chains during unrolling
Nikita Popov via All-commits
all-commits at lists.llvm.org
Wed Jul 5 00:54:47 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b9808e5660f5fe9e7414c0c0b93acd899235471c
https://github.com/llvm/llvm-project/commit/b9808e5660f5fe9e7414c0c0b93acd899235471c
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-07-05 (Wed, 05 Jul 2023)
Changed paths:
M llvm/lib/Transforms/Utils/LoopUnroll.cpp
M llvm/test/Analysis/ScalarEvolution/2012-05-29-MulAddRec.ll
M llvm/test/DebugInfo/unrolled-loop-remainder.ll
M llvm/test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll
M llvm/test/Transforms/LoopUnroll/AArch64/partial.ll
M llvm/test/Transforms/LoopUnroll/ARM/instr-size-costs.ll
M llvm/test/Transforms/LoopUnroll/ARM/loop-unrolling.ll
M llvm/test/Transforms/LoopUnroll/ARM/multi-blocks.ll
M llvm/test/Transforms/LoopUnroll/PowerPC/p7-unrolling.ll
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/RISCV/unroll.ll
M llvm/test/Transforms/LoopUnroll/X86/mmx.ll
M llvm/test/Transforms/LoopUnroll/add-folding-overflow.ll
M llvm/test/Transforms/LoopUnroll/full-unroll-keep-first-exit.ll
M llvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll
M llvm/test/Transforms/LoopUnroll/partial-unroll-non-latch-exit.ll
M llvm/test/Transforms/LoopUnroll/partially-unroll-unconditional-latch.ll
M llvm/test/Transforms/LoopUnroll/runtime-exit-phi-scev-invalidation.ll
M llvm/test/Transforms/LoopUnroll/runtime-loop-at-most-two-exits.ll
M llvm/test/Transforms/LoopUnroll/runtime-loop-multiexit-dom-verify.ll
M llvm/test/Transforms/LoopUnroll/runtime-loop-multiple-exits.ll
M llvm/test/Transforms/LoopUnroll/runtime-loop5.ll
M llvm/test/Transforms/LoopUnroll/runtime-multiexit-heuristic.ll
M llvm/test/Transforms/LoopUnroll/runtime-small-upperbound.ll
M llvm/test/Transforms/LoopUnroll/runtime-unroll-assume-no-remainder.ll
M llvm/test/Transforms/LoopUnroll/scev-invalidation-lcssa.ll
M llvm/test/Transforms/LoopUnroll/shifted-tripcount.ll
M llvm/test/Transforms/LoopUnroll/tripcount-overflow.ll
M llvm/test/Transforms/LoopUnroll/unroll-header-exiting-with-phis.ll
M llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
M llvm/test/Transforms/LoopUnrollAndJam/dependencies_visit_order.ll
M llvm/test/Transforms/LoopUnrollAndJam/unroll-and-jam.ll
Log Message:
-----------
[LoopUnroll] Fold add chains during unrolling
Loop unrolling tends to produce chains of
`%x1 = add %x0, 1; %x2 = add %x1, 1; ...` with one add per unrolled
iteration. This patch simplifies these adds to `%xN = add %x0, N`
directly during unrolling, rather than waiting for InstCombine to do so.
The motivation for this is that having a single add (rather than
an add chain) on the induction variable makes it a simple recurrence,
which we specially recognize in a number of places. This allows
InstCombine to directly perform folds with that knowledge, instead
of first folding the add chains, and then doing other folds in another
InstCombine iteration.
Due to the reduced number of InstCombine iterations, this also
results in a small compile-time improvement.
Differential Revision: https://reviews.llvm.org/D153540
More information about the All-commits
mailing list