[all-commits] [llvm/llvm-project] 0a74a7: [mlir] scf::ForOp: Drop iter arguments (and corres...

lorenzo chelini via All-commits all-commits at lists.llvm.org
Wed Mar 17 05:07:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a74a7161baff6365be49217faa419cd41fb930b
      https://github.com/llvm/llvm-project/commit/0a74a7161baff6365be49217faa419cd41fb930b
  Author: lorenzo chelini <l.chelini at tue.nl>
  Date:   2021-03-17 (Wed, 17 Mar 2021)

  Changed paths:
    M mlir/lib/Dialect/SCF/SCF.cpp
    M mlir/test/Dialect/SCF/canonicalize.mlir

  Log Message:
  -----------
  [mlir] scf::ForOp: Drop iter arguments (and corresponding result) with no use

'ForOpIterArgsFolder' can now remove iterator arguments (and corresponding
results) with no use.

Example:

```
%cst = constant 32 : i32

%0:2 = scf.for %arg1 = %lb to %ub step %step iter_args(%arg2 = %arg0, %arg3 = %cst)
  -> (i32, i32) {
  %1 = addu %arg2, %cst : i32
  scf.yield %1, %1 : i32, i32
}

use(%0#0)

```

%arg3 is not used in the block, and its corresponding result `%0#1` has no use,
thus remove the iter argument.

Reviewed By: nicolasvasilache

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




More information about the All-commits mailing list