ruiu accepted this revision. ruiu added a comment. This revision is now accepted and ready to land. LGTM. I still think that there's a way to reduce the number of parameters, but this patch is good enough to land. https://reviews.llvm.org/D26508