[all-commits] [llvm/llvm-project] 69853f: [IVUsers] Move preheader check into SCEVExpander

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Oct 14 12:53:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 69853f992048efa7fd1b2700b7b71def72300682
      https://github.com/llvm/llvm-project/commit/69853f992048efa7fd1b2700b7b71def72300682
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2021-10-14 (Thu, 14 Oct 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/IVUsers.h
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Analysis/IVUsers.cpp
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp

  Log Message:
  -----------
  [IVUsers] Move preheader check into SCEVExpander

Rather than checking for loop nest preheaders upfront in IVUsers,
move this requirement into isSafeToExpand() from SCEVExpander.

Historically, LSR did not check whether SCEVs are safe to expand
and fully relied on IVUsers to validate this. Later, support for
non-expandable SCEVs was added via rigid formulas.

Checking this in isSafeToExpand() makes it more obvious what
exactly this check is guarding against, and avoids the awkward
loop nest scan.

This is a followup to https://reviews.llvm.org/D111493#3055286.

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




More information about the All-commits mailing list