eugenis added a comment. Cool. Would it be better to avoid the use of IRBuilder, and switch the targetlowering hooks to the same signature as in http://reviews.llvm.org/D17736? Value *..(Module &); Repository: rL LLVM http://reviews.llvm.org/D18632