[all-commits] [llvm/llvm-project] 88b7e8: [mlir][SCF] Add an scf.take_assumed_branch transfo...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Wed Apr 12 08:51:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88b7e8e0f06dd22d228d7fa7eb7e4d112342e3ed
      https://github.com/llvm/llvm-project/commit/88b7e8e0f06dd22d228d7fa7eb7e4d112342e3ed
  Author: Nicolas Vasilache <nicolas.vasilache at gmail.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.h
    M mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
    M mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
    A mlir/test/Dialect/SCF/transform-op-take-assumed-branch.mlir

  Log Message:
  -----------
  [mlir][SCF] Add an scf.take_assumed_branch transform op.

Given an scf.if conditional, using this transformation is akin to injecting
user-specified information that it is always safe to execute only the specified
`if` or `else` branch.

This is achieved by just replacing the scf.if by the content of one of its
branches.

This is particularly useful for user-controlled rewriting of conditionals
that exist solely to guard against out-of-bounds behavior.

At the moment, no assume or assert operation is emitted as it is not always
desirable. In the future, this may be controlled by a dedicated attribute.

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




More information about the All-commits mailing list