loladiro added a comment. Dropping metadata is already implemented in the ValueMaterializer interface. However, I don't think the other things I'm doing are doable with that interface. I suppose we could extend it? @dexonsmith, thoughts on that? http://reviews.llvm.org/D16083