[RFC] EBO issue on Trait class inheritance when targeting the MSVC ABI

The ::mlir::Op class does not have a size of 8 when targeting the MSVC ABI caused by a longstanding bug of MSVC.

This may slow down the speed of MLIR Pass on Windows. See the example code with O2 optimization:

and the example code with O0 optimization:

The example shows that the size of mlir::Op<Traits...> without optimization is 72 (no_opt_size).
The optimized one with __declspec(empty_bases) is 8 (opt_size). The ::mlir::Op also affects the function call without inlining.

But I did not see much workaround in the LLVM project, other than this commit.

libc: Fix std::tuples EBO when targeting the MSVC ABI.

Should we add the attribute __declspec(empty_bases) for the ::mlir::Op class?

Myriad Dreamin