How to compare IR/object files statically for predicting better performance for machine learning based cost models

I have a bunch of assorted scripts in GitHub - boomanaiden154/regalloc-cost-model-evaluation. Essentially I took an executable, compiled it with clang with -fprofile-instr-generate, ran the program, recompiled with -fprofile-instr-use, -mllvm -mbb-profile-dump, and fbasic-block-sections=labels. Then I wrote a script that extracted the basic blocks using the data in the .llvm_bb_addr_map section and ran them through uiCA, multiplying them by the relative block frequencies in the MBB profile dump. I only tested on a couple small executables rather than a broad variety of code, so my process might result in very different numbers depending upon the type of program. In addition, I made sure that everything was inlined into a single function so that I didn’t have to worry about the call graph at all, so that could be complicating things even more.

2 Likes