[all-commits] [llvm/llvm-project] 87e6fd: [MLIR] Erase unreachable blocks before applying pa...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Aug 18 02:00:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87e6fd161a6a2557452a5d4726e4ad184c413917
      https://github.com/llvm/llvm-project/commit/87e6fd161a6a2557452a5d4726e4ad184c413917
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2025-08-18 (Mon, 18 Aug 2025)

  Changed paths:
    M mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
    M mlir/test/Dialect/Arith/canonicalize.mlir
    M mlir/test/Transforms/test-canonicalize.mlir

  Log Message:
  -----------
  [MLIR] Erase unreachable blocks before applying patterns in the greedy rewriter (#153957)

Operations like:

    %add = arith.addi %add, %add : i64

are legal in unreachable code. Unfortunately many patterns would be
unsafe to apply on such IR and can lead to crashes or infinite loops. To
avoid this we can remove unreachable blocks before attempting to apply
patterns.
We may have to do this also whenever the CFG is changed by a pattern, it
is left up for future work right now.

Fixes #153732



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