efriedma added a comment. For reference, I also ran into this problem at one point, and came up with a hack to just turn off trace-based optimizations for long basic blocks. This implementation looks nicer. :) https://reviews.llvm.org/D36619