[all-commits] [llvm/llvm-project] 4b47d8: [LV] Optimize trip count SCEV.

Craig Topper via All-commits all-commits at lists.llvm.org
Wed Apr 12 16:20:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4b47d875a1f9083ed788dac32bde45364afb8668
      https://github.com/llvm/llvm-project/commit/4b47d875a1f9083ed788dac32bde45364afb8668
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/lib/Transforms/Vectorize/VPlan.h
    M llvm/test/Transforms/LoopVectorize/RISCV/riscv-unroll.ll
    M llvm/test/Transforms/LoopVectorize/X86/conversion-cost.ll
    M llvm/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll

  Log Message:
  -----------
  [LV] Optimize trip count SCEV.

To calculate the trip count we need to add 1 to the backedge
taken count. If we need to widen the backedge count, it's better
to do the add before the widening if we can guarantee it won't
overflow.

The code here is based on similar code I found in
LoopIdiomRecognize.

This is the vectorizer version of this InstCombine patch D142783.
Looking at the IR diffs, this does look like it gets more cases
than the InstCombine patch.

Reviewed By: reames

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




More information about the All-commits mailing list