Skip to content

[MLIR] RemoveDeadValues pass errors on unreachable operation #153906

@Sirraide

Description

@Sirraide

Consider (https://godbolt.org/z/7c7oqqEY7):

module @test {  func.func @foo() { %false = arith.constant false %zero = arith.constant 0 : i64  cf.cond_br %false, ^bb1, ^bb4 ^bb1: %3 = arith.cmpi eq, %zero, %zero : i64  cf.br ^bb1 ^bb4:  return } }

For some reason --remove-dead-values chokes on this and errors rather than just removing the block

<source>:7:10: error: null operand found  %3 = arith.cmpi eq, %zero, %zero : i64  ^ <source>:7:10: note: see current operation: %1 = "arith.cmpi"(<<NULL VALUE>>, <<NULL VALUE>>) <{predicate = 0 : i64}> : (<<NULL TYPE>>, <<NULL TYPE>>) -> i1

Not sure if #153732 is in any way related but in both cases the cause of the problem seems to be an unreachable block.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions