[all-commits] [llvm/llvm-project] 5443d2: [MLIR][SCF] Simplify scf.if by swapping regions if...

William Moses via All-commits all-commits at lists.llvm.org
Tue Jan 11 09:57:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5443d2ed982dc8e0ccbf2089a78659baec4fcd37
      https://github.com/llvm/llvm-project/commit/5443d2ed982dc8e0ccbf2089a78659baec4fcd37
  Author: William S. Moses <gh at wsmoses.com>
  Date:   2022-01-11 (Tue, 11 Jan 2022)

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

  Log Message:
  -----------
  [MLIR][SCF] Simplify scf.if by swapping regions if condition is a not

Given an if of the form, simplify it by eliminating the not and swapping the regions

scf.if not(c) {
  yield origTrue
} else {
  yield origFalse
}

becomes

scf.if c {
  yield origFalse
} else {
  yield origTrue
}

Reviewed By: mehdi_amini

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




More information about the All-commits mailing list