Skip to content

[mlir] remove-dead-values pass gives null operand error #82788

Open
@pingshiyu

Description

@pingshiyu

I was compiling the below program using:
mlir-opt --remove-dead-values out.mlir

"builtin.module"() ({
    ^bb0(): 
        "func.func"() ({
            ^bb0(%1 : i1, %2 : i1): 
                %3 = "arith.constant"() {value=1 : i1} : () -> (i1)
                "func.return"(%2, %3) : (i1, i1) -> ()
            }) {sym_name="func0", function_type=(i1, i1) -> (i1, i1)} : () -> ()
        "func.func"() ({
            ^bb0(%4 : i1): 
                %5 = "arith.constant"() {value=true} : () -> (i1)
                %7, %8 = "func.call"(%5, %4) {callee=@func0} : (i1, i1) -> (i1, i1)
                "func.return"(%7, %8) : (i1, i1) -> ()
            }) {sym_name="func1", function_type=(i1) -> (i1, i1)} : () -> ()
    }) : () -> ()

However, I get the following error:

<source>:11:26: error: null operand found
                %7, %8 = "func.call"(%5, %4) {callee=@func0} : (i1, i1) -> (i1, i1)
                         ^
<source>:11:26: note: see current operation: %0:2 = "func.call"(<<NULL VALUE>>, %arg0) <{callee = @func0}> : (<<NULL TYPE>>, i1) -> (i1, i1)
Compiler returned: 1

I do not understand the error message, as the variables used in the function call do not look null at all to me. The above is the reduced test case. The Pass documentation didn't yield anything useful regarding this error, unfortunately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions