I think we should take this back to the principles and how they balance out. I can see things like:
- Hopefully obvious: we want MLIR infra to be good and a progression vs LLVM decisions.
- We desire foreign dialects in MLIR to be close to the thing they model to make
mlir-translate
logic simpler and easier to test. - The LLVM dialect in particular should be amenable to standard MLIR optimizations, and there is a possible future in which all existing LLVM passes get migrated over to it.
There is some tension between #1 and #2: for example, we have explicit “llvm.mlir.constant” operations and BB arguments instead of an “llvm.phi” operation. I don’t think that any of us are willing to waver on this.
OTOH, the tension I see is between #2 and #3. For example, Alex observes that we can have the LLVM dialect require predecessors to have identical BB args which would favor #2 but hurt #3.
I see two solutions to this:
- Give up on optimizing the LLVM dialect, and have a “llvm+” dialect which gets lowered down to the LLVM dialect.
- Accept modest changes (e.g. the bb arg thing that started the thread) and accept that the translation is less of an isomorphic change, e.g. requiring a “prepare” pass of some sort.
For me personally, given the things that we’re talking about in practice - I think that #2 is the right way to go. If it turns out that we’re start doing heroic things in the future, then we should reconsider. However, I don’t see anything that warrants the complexity of having two things and introducing a new lowering pass (most of which would be 1 to 1).
-Chris