[all-commits] [llvm/llvm-project] 54e560: [mlir] fix wrong symbol order in AffineApplyNormal...

ftynse via All-commits all-commits at lists.llvm.org
Thu Feb 27 06:17:58 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 54e5600e4d28535d4296a6b6baeefccc9cc9d904
      https://github.com/llvm/llvm-project/commit/54e5600e4d28535d4296a6b6baeefccc9cc9d904
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-02-27 (Thu, 27 Feb 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/AffineOps/AffineOps.h
    M mlir/lib/Dialect/AffineOps/AffineOps.cpp
    M mlir/test/Dialect/AffineOps/canonicalize.mlir

  Log Message:
  -----------
  [mlir] fix wrong symbol order in AffineApplyNormalizer

Summary:
AffineApplyNormalizer provides common logic for folding affine maps that appear
in affine.apply into other affine operations that use the result of said
affine.apply. In the process, affine maps of both operations are composed.
During the composition `A.compose(B)` the symbols from the map A are placed
before those of the map B in a single concatenated symbol list. However,
AffineApplyNormalizer was ordering the operands of the operation being
normalized by iteratively appending the symbols into a single list accoridng to
the operand order, regardless of whether these operands are symbols of the
current operation or of the map that is being folded into it. This could lead
to wrong order of symbols and, when the symbols were bound to constant values,
to visibly incorrect folding of constants into affine maps as reported in
PR45031. Make sure symbols operands to the current operation are always placed
before symbols coming from the folded maps.

Update the test that was exercising the incorrect folder behavior. For some
reason, the order of symbol operands was swapped in the test input compared to
the previous operations, making it easy to assume the correct maps were
produced whereas they were swapping the symbols back due to the problem
described above.

Closes https://bugs.llvm.org/show_bug.cgi?id=45031

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




More information about the All-commits mailing list