diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp --- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp +++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp @@ -662,6 +662,12 @@ if (!isa(U) && !isa(U)) continue; auto &CS = *cast(U); + + // This should not happen at the moment; however, it may if we start + // specializing functions that have their addresses taken. + assert(CS.getCalledFunction() == F && + "Function and callee should be same!"); + // If the call site has attribute minsize set, that callsite won't be // specialized. if (CS.hasFnAttr(Attribute::MinSize)) {