[all-commits] [llvm/llvm-project] b6bab6: [MLIR][transforms] Fix `cloneInto()` error in `Rem...

Srishti Srivastava via All-commits all-commits at lists.llvm.org
Sat Aug 26 12:50:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b6bab6db9bea2793634bec2e33385f3d89a5e7f3
      https://github.com/llvm/llvm-project/commit/b6bab6db9bea2793634bec2e33385f3d89a5e7f3
  Author: Srishti Srivastava <srishtisrivastava.ai at gmail.com>
  Date:   2023-08-26 (Sat, 26 Aug 2023)

  Changed paths:
    M mlir/lib/Transforms/RemoveDeadValues.cpp
    M mlir/test/Transforms/remove-dead-values.mlir

  Log Message:
  -----------
  [MLIR][transforms] Fix `cloneInto()` error in `RemoveDeadValues` pass

This commit fixes an error in the `RemoveDeadValues` pass that is
associated with its incorrect usage of the `cloneInto()` function.

The `setOperands()` function that is used by the `cloneInto()` function
requires all operands to not be null. But, that is not possible in this
pass because we drop uses of dead values, thus making them null. It is
only at the end of the pass that we are assured that such null values
won't exist but during the execution of the pass, there could be null
values.

To fix this, we replace the usage of the `cloneInto()` function to copy
a region with `moveBlock()` to move each block of the region one by one.
This function does not require the presence of non-null values and is
thus the right choice here. This implementation is also more opttimized
because we are moving things instead of copying them. The goal was
always moving.

Signed-off-by: Srishti Srivastava <srishtisrivastava.ai at gmail.com>

Reviewed By: srishti-pm

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




More information about the All-commits mailing list