aprantl added a comment. Would it be possible to add a test for the unmaterialized functions? Sounds like it could be hard though. The removal of the useless check for the entry block is LGTM as a separate NFC commit. http://reviews.llvm.org/D21042