I want to use the applyPatternsAndFoldGreedily function to change the Op in ModuleOp. but the ModuleOp is empty after applyPatternsAndFoldGreedily is called.
What does the content of the module look like? Do you have only side-effect-free operations that can all be folded away?
If you remove your pattern from the set what happens?
In general running with -debug should show you step by step what happens.
applyPatternsAndFoldGreedily also performs DCE, so if your ops are considered side effect free and aren’t returning anywhere, they are probably being DCE’ed. I’ve never seen ops directly in a module, so I don’t know if that affects this situation.
Nothing is using the results of your pulsar.conv operation: this is covered by what I described earlier as Do you have only side-effect-free operations that can all be folded away??
If you were to add an operation, let’s say pulsar.print(%2) that wouldn’t be side-effect free, this should all work.
Also in general we use another container inside the module, such as a function or a graph, or a program: there will have a way to express input/output (or argument/results).