egraphs-good / eggcc

MIT License
42 stars 8 forks source link

Save unoptimized and optimized LLVM IR when `--llvm-output_dir` is provided #512

Closed rtjoa closed 4 months ago

rtjoa commented 4 months ago

For --run-mode=compile-bril-llvm, when --llvm-output-dir=DIR is provided, save compile-unopt.ll and compile.ll to DIR.

Note that when these options are provided, it runs clang a second time, as I don't think it's possible to dump llvm ir and the binary in the same command. An alternative would be to break up opt and llc from the other stages of clang, but that would lead to more complexity in the common case.

Example:

$ cargo run benchmarks/passing/bril/mem/fib.bril --optimize-egglog=true --optimize-bril-llvm=true --run-mode=compile-bril-llvm --llvm-output-dir=output
$ ls output
compile-unopt.ll compile.ll