diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -249,11 +249,12 @@ /// Search for the first call to the llvm.stackprotector intrinsic and return it /// if present. static const CallInst *findStackProtectorIntrinsic(Function &F) { + Function *StackProtectorDecl = + Intrinsic::getDeclaration(F.getParent(), Intrinsic::stackprotector); for (const BasicBlock &BB : F) for (const Instruction &I : BB) if (const CallInst *CI = dyn_cast(&I)) - if (CI->getCalledFunction() == - Intrinsic::getDeclaration(F.getParent(), Intrinsic::stackprotector)) + if (CI->getCalledFunction() == StackProtectorDecl) return CI; return nullptr; }