[all-commits] [llvm/llvm-project] 8272b6: [mlir][IR] Fix bug in AffineExpr simplifier `lhs %...

Christopher Bate via All-commits all-commits at lists.llvm.org
Wed Dec 18 14:23:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8272b6bd6146aab973ff7018ad642b99fde00904
      https://github.com/llvm/llvm-project/commit/8272b6bd6146aab973ff7018ad642b99fde00904
  Author: Christopher Bate <cbate at nvidia.com>
  Date:   2024-12-18 (Wed, 18 Dec 2024)

  Changed paths:
    M mlir/lib/IR/AffineExpr.cpp
    M mlir/unittests/IR/AffineExprTest.cpp

  Log Message:
  -----------
  [mlir][IR] Fix bug in AffineExpr simplifier `lhs % rhs` where `lhs = lhs floordiv rhs` (#119245)

Fixes an issue where the `SimpleAffineExprFlattener` would simplify
`lhs % rhs` to just `-(lhs floordiv rhs)` instead of 
`lhs - (lhs floordiv rhs)`
if `lhs` happened to be equal to `lhs floordiv rhs`.

The reported failure case was 
`(d0, d1) -> (((d1 - (d1 + 2)) floordiv 8) % 8)`
from https://github.com/llvm/llvm-project/issues/114654.

Note that many paths that simplify AffineMaps (e.g. the AffineApplyOp
folder and canonicalization) would not observe this bug because of
of slightly different paths taken by the code. Slightly different
grouping of the terms could also result in avoiding the bug.

Resolves https://github.com/llvm/llvm-project/issues/114654.



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