davidxl accepted this revision. davidxl added a comment. This revision is now accepted and ready to land. If you have time, finding a way to speed up the method will be welcome (such as the fast path suggestion). http://reviews.llvm.org/D14845