[all-commits] [llvm/llvm-project] 6444a6: [LSR] Fixup canonicalization formula and its checker.

serguei-katkov via All-commits all-commits at lists.llvm.org
Tue Mar 29 00:05:54 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6444a65514b58c6df7db41151e982e7859ac2548
      https://github.com/llvm/llvm-project/commit/6444a65514b58c6df7db41151e982e7859ac2548
  Author: Serguei Katkov <serguei.katkov at azul.com>
  Date:   2022-03-29 (Tue, 29 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    A llvm/test/Transforms/LoopStrengthReduce/canonical-form.ll

  Log Message:
  -----------
  [LSR] Fixup canonicalization formula and its checker.

According to definition of canonical form, it is a canonical
if scale reg does not contain addrec for loop L then none of bases
should contain addrec for this loop.

The critical word here is "contains".

Current checker of canonical form checks not "containing" property
but "is". So it does not check whether it contains but whether it is.

Fix the checker and canonicalizing utility to follow definition.

Without this fix in the test attached the base formula looking as
reg((-1 * {0,+,8}<nuw><nsw><%bb2>)<nsw>) + 1*reg((8 * (%arg /u 8))<nuw>)
is considered as conanocial while base contains an addrec.
And modified formula we want to insert
reg({0,+,8}<nuw><nsw><%bb2>) + 1*reg((-8 * (%arg /u 8)))
is considered as not canonical.

Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D122457




More information about the All-commits mailing list