rust-lang/llvm — pull request #3 by c-a (2014-01-27 13:03:47+00:00)
Title: Add getPassInfo() function to llvm::Pass

When profiling rust compilation I found that llvm spends a lot of time in llvm::PassRegistry::getPassInfo(). To try to fix this I wrote a simple hacky patch for llvm which basically caches the result from llvm::PassRegistry::getPassInfo() in it's corresponding pass. Although hacky it works well in eliminating llvm::PassRegistry::getPassInfo() from my profiles and cuts approximately 50 seconds from a rustc-stage2 build in my testing.

I sent the patch to the llvm list (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20131223/200046.html) asking for feedback on doing a proper fix but I haven't got any response yet. Anyway since this cuts compilation time quite considerably it may be worthwhile to include this in the rust fork of llvm for now.

-- Before --
Fraction spent in lvm::PassRegistry::getPassInfo() according to callgrind when compiling sudoku.rs: 14.01

- After doing make rustc-stage1
time make -j4 rustc-stage2
real	5m56.428s
user	5m40.291s
sys	0m7.293s

-- After --
Fracion spent in lvm::PassRegistry::getPassInfo() according to callgrind when compiling sudoku.rs: 0.07

- After doing make rustc-stage1
time make -j4 rustc-stage2
real	5m16.838s
user	4m55.682s
sys	0m7.536s