[all-commits] [llvm/llvm-project] 26f93d: [mlir] OperationFolder: fix crash in creation of s...

ftynse via All-commits all-commits at lists.llvm.org
Wed May 6 11:40:55 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 26f93d9f373a1e638b621391ef7ba9bdf7b79044
      https://github.com/llvm/llvm-project/commit/26f93d9f373a1e638b621391ef7ba9bdf7b79044
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-05-06 (Wed, 06 May 2020)

  Changed paths:
    M mlir/include/mlir/Transforms/FoldUtils.h
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/test/lib/Dialect/Test/TestPatterns.cpp

  Log Message:
  -----------
  [mlir] OperationFolder: fix crash in creation of single-result-ops with in-place folds

When the folding is performed in place, the `::fold` function does not populate
its `results` argument to indicate that. (In the folding hook for single-result
operations, the result of the original operation is expected to be returned,
but it is then ignored by the wrapper.) `OperationFolder::create` would
erronously rely on the _operation_ having zero results instead of on the
_folding_ producing zero new results to populate the list of results with those
of the original operation. This would lead to a crash for single-result ops
with in-place folds where the first result is accessed uncondtionally because
the list of results was not properly populated. Use the list of values produced
by the folding instead.

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




More information about the All-commits mailing list