[PSA] Special case parsing of `func` operations is being removed

tldr; I’ve sent out a patch to remove the special case parsing of func operations.

This was noted in the past when FuncOp was moved out of the builtin dialect > 1 month ago, but the special case parsing of func operations is being removed. What this means concretely is that in .mlir files you will need to explicitly namespace func operations (outside of func.func regions). More concretely, you will need to change things like:

func @foo() {
  scf.if ... {
    call @bar()
  }
  return
}

to

func.func @foo() {
  scf.if ... {
    func.call @bar()
  }
  return
}

I’ll let the patch sit up for a ~two weeks or so, but if you haven’t updated since the first few notices please try to proactively update. As always I will take care of updating in-tree usages, of which nearly all have already been taken care of. Upstream MLIR had ~800 files to update, and nearly all were able to be updated automatically with a simple regex find/replace: ^( *)func $1func.func .

– River

1 Like

What kind of cases couldn’t be supported by this regex?

The only cases I manually handled were call(i.e. func.call) operations nested in loops (so outside of func.func regions), and .c/.cpp files that manually parsed MLIR strings (think situations like parseString("func @). There were so few of these (~20) that I just updated them manually (took ~5-10 minutes). I could have constructed a regex for the calls, but it was faster to just replace them in IDE.

1 Like

FYI, this has landed now.

1 Like