From b264d69de7dfcb94da9719a59bdd2fd3a8063b6a Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 21 Dec 2018 21:49:40 +0000 Subject: [IR] Add Instruction::isLifetimeStartOrEnd, NFC Instruction::isLifetimeStartOrEnd() checks whether an Instruction is an llvm.lifetime.start or an llvm.lifetime.end intrinsic. This was suggested as a cleanup in D55967. Differential Revision: https://reviews.llvm.org/D56019 llvm-svn: 349964 --- llvm/lib/CodeGen/StackProtector.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'llvm/lib/CodeGen/StackProtector.cpp') diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index dcf37ca76b2..3b578c7391d 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/lib/CodeGen/StackProtector.cpp @@ -157,14 +157,6 @@ bool StackProtector::ContainsProtectableArray(Type *Ty, bool &IsLarge, return NeedsProtector; } -static bool isLifetimeInst(const Instruction *I) { - if (const auto Intrinsic = dyn_cast(I)) { - const auto Id = Intrinsic->getIntrinsicID(); - return Id == Intrinsic::lifetime_start || Id == Intrinsic::lifetime_end; - } - return false; -} - bool StackProtector::HasAddressTaken(const Instruction *AI) { for (const User *U : AI->users()) { if (const StoreInst *SI = dyn_cast(U)) { @@ -175,7 +167,7 @@ bool StackProtector::HasAddressTaken(const Instruction *AI) { return true; } else if (const CallInst *CI = dyn_cast(U)) { // Ignore intrinsics that are not calls. TODO: Use isLoweredToCall(). - if (!isa(CI) && !isLifetimeInst(CI)) + if (!isa(CI) && !CI->isLifetimeStartOrEnd()) return true; } else if (isa(U)) { return true; -- cgit v1.2.3