[all-commits] [llvm/llvm-project] eb9b22: [LV] Use SCEV for uniformity analysis across VF.

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Apr 28 02:22:37 PDT 2023


  Branch: refs/heads/perf/scev-uniform
  Home:   https://github.com/llvm/llvm-project
  Commit: eb9b22c57f7ed429dfd3852e8cb11cdb06b567cf
      https://github.com/llvm/llvm-project/commit/eb9b22c57f7ed429dfd3852e8cb11cdb06b567cf
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-04-28 (Fri, 28 Apr 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/LoopAccessAnalysis.h
    M llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
    M llvm/lib/Analysis/LoopAccessAnalysis.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
    M llvm/test/Transforms/LoopVectorize/pr47343-expander-lcssa-after-cfg-update.ll
    M llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1.ll
    M llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1_and.ll
    M llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction1_lshr.ll
    M llvm/test/Transforms/LoopVectorize/uniform_across_vf_induction2.ll

  Log Message:
  -----------
  [LV] Use SCEV for uniformity analysis across VF.

This patch uses SCEV to check if a value is uniform across a given VF.

The basic idea is to construct SCEVs where the AddRecs of the loop are
adjusted to reflect the version in the vectorized loop (Step multiplied
by VF). We construct a SCEV for the value of the first vector lane
(offset 0) and one for the last vector lane (VF - 1). If they are equal,
consider the expression uniform.

While re-writing expressions, we also need to catch expressions we
cannot determine uniformity (e.g. SCEVUnknown).

I might be missing something that makes this approach unworkable in
practice, but it may be an alternative to D147735.

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




More information about the All-commits mailing list