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

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed May 31 08:01:24 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 572cfa3fde5433c889b339e9cfa6dfaa23e5f2ee
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-05-31 (Wed, 31 May 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_div_urem.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 vector lane 0
(offset 0) compare it to the expressions for lanes 1 to 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).

Reviewed By: Ayal

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

More information about the All-commits mailing list