I was looking for a way to shrink the MLIR build-and-install time. It looks like with -DLLVM_ENABLE_PROJECTS=mlir and -DLLVM_TARGETS_TO_BUILD="Native", I will end up building lots of LLVM stuff. E.g., I see lots of .o files being built in lib/Analysis/CMakeFiles/LLVMAnalysis.dir/ that presumably have nothing to do with MLIR. Time for just a debug build is over an hour for me. That’s with g++. I can try the changes to force use of clang++.
LLVM is configured, so ninja alone will build all of LLVM.
There is no strict definition of “MLIR without LLVM” and so there isn’t a build target to this.
Since the MLIR tests are including some integrations tests we end up building most of LLVM to be able to run these tests. We also have a JIT integration in MLIR, and so building this library will depend on the LLVM optimizer/codegen as well.
This is why I wrote the examples, building ninja mlir-minimal-opt should not build any of LLVM hopefully.
Thanks, ninja mlir-minimal-opt did the trick.
For beginners like me, here are the commands to build mlir-minimal-opt after a fresh checkout of llvm-project: