Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -3153,8 +3153,14 @@ "Cannot invoke an intrinsinc other than" " donothing or patchpoint", &I); - Assert(F->getParent() == M, "Referencing function in another module!", - &I); + Module *ParentM = F->getParent(); + Assert(ParentM == M, + "Referencing function in module `" + + (ParentM ? std::string(ParentM->getName()) + : std::string("null")) + + "` from another module (`" + + (M ? std::string(M->getName()) : std::string("null")) + "`)!", + &I, F, BB->getParent()); } else if (BasicBlock *OpBB = dyn_cast(I.getOperand(i))) { Assert(OpBB->getParent() == BB->getParent(), "Referring to a basic block in another function!", &I);