[all-commits] [llvm/llvm-project] 306b9c: [SCEV] Handle more add/addrec mixes in computeCons...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Aug 13 02:02:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 306b9c7b48ade28ed10e5926b6d9f5e3acab3968
      https://github.com/llvm/llvm-project/commit/306b9c7b48ade28ed10e5926b6d9f5e3acab3968
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-08-13 (Tue, 13 Aug 2024)

  Changed paths:
    M llvm/lib/Analysis/ScalarEvolution.cpp
    M llvm/test/Transforms/LoopVectorize/skeleton-lcssa-crash.ll
    M llvm/unittests/Analysis/ScalarEvolutionTest.cpp

  Log Message:
  -----------
  [SCEV] Handle more add/addrec mixes in computeConstantDifference() (#101999)

computeConstantDifference() can currently look through addrecs with
identical steps, and then through adds with identical operands (apart
from constants).

However, it fails to handle minor variations, such as two nested add
recs, or an outer add with an inner addrec (rather than the other way
around).

This patch supports these cases by adding a loop over the
simplifications, limited to a small number of iterations. The motivation
is the same as in #101339, to make
computeConstantDifference() powerful enough to replace existing uses of
`dyn_cast<SCEVConstant>(getMinusSCEV())` with it. Though as the IR test
diff shows, other callers may also benefit.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list