See https://github.com/llvm/llvm-project/issues/57475 for more context.
Using auto-generated constructors and options has significant advantages:
- It forces a uniform style and expectation for consuming a pass
- It allows to very easily add, remove or change options to a pass by simply making the changes in TableGen
- Its less code
This patch in particular ports all the conversion passes which lower to LLVM to use the auto generated constructors and options. For the most part, care was taken so that auto generated constructor functions have the same name as they previously did. Only following slight breaking changes (which I consider as worth the churn) have been made:
- mlir::cf::createConvertControlFlowToLLVMPass has been moved to the mlir namespace. This is consistent with basically all conversion passes
- createGpuToLLVMConversionPass now takes a proper options struct array for its pass options. The pass options are now also autogenerated.
- LowerVectorToLLVMOptions has been replaced by the autogenerated ConvertVectorToLLVMPassOptions which is automatically kept up to date by TableGen
- I had to move one function in the GPU to LLVM lowering as it is used as default value for an option.
- All passes that previously returned unique_ptr<OperationPass<...>> now simply return unique_ptr<Pass>