[all-commits] [llvm/llvm-project] ddc989: Add operands to worklist when only used by deleted...

mlevesquedion via All-commits all-commits at lists.llvm.org
Fri Mar 29 13:39:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ddc9892999a42f9fd069f9786b82cb63312eba63
      https://github.com/llvm/llvm-project/commit/ddc9892999a42f9fd069f9786b82cb63312eba63
  Author: mlevesquedion <mlevesquedion at google.com>
  Date:   2024-03-29 (Fri, 29 Mar 2024)

  Changed paths:
    M flang/test/Transforms/stack-arrays.fir
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    A mlir/test/IR/greedy-pattern-rewrite-driver-bottom-up.mlir
    A mlir/test/IR/greedy-pattern-rewrite-driver-top-down.mlir
    R mlir/test/IR/greedy-pattern-rewriter-driver.mlir

  Log Message:
  -----------
  Add operands to worklist when only used by deleted op (#86990)

I believe the existing check to determine if an operand should be added
is incorrect: `operand.use_empty() || operand.hasOneUse()`. This is
because these checks do not take into account the fact that the op is
being deleted. It hasn't been deleted yet, so `operand.use_empty()`
cannot be true, and `operand.hasOneUse()` may be true if the op being
deleted is the only user of the operand and it only uses it once, but it
will fail if the operand is used more than once (e.g. something like
`add %0, %0`).

Instead, check if the op being deleted is the only _user_ of the
operand. If so, add the operand to the worklist.

Fixes #86765



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list