diff options
author | Vedant Kumar <vsk@apple.com> | 2018-12-21 21:49:40 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-12-21 21:49:40 +0000 |
commit | b264d69de7dfcb94da9719a59bdd2fd3a8063b6a (patch) | |
tree | f5440f9e50894ba9cea733d240fbc14627ea424a /llvm/lib/CodeGen/StackProtector.cpp | |
parent | 8ed73c20586e073221b4e712a399b10fdb290fa4 (diff) | |
download | bcm5719-llvm-b264d69de7dfcb94da9719a59bdd2fd3a8063b6a.tar.gz bcm5719-llvm-b264d69de7dfcb94da9719a59bdd2fd3a8063b6a.zip |
[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
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 10 |
1 files changed, 1 insertions, 9 deletions
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<IntrinsicInst>(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<StoreInst>(U)) { @@ -175,7 +167,7 @@ bool StackProtector::HasAddressTaken(const Instruction *AI) { return true; } else if (const CallInst *CI = dyn_cast<CallInst>(U)) { // Ignore intrinsics that are not calls. TODO: Use isLoweredToCall(). - if (!isa<DbgInfoIntrinsic>(CI) && !isLifetimeInst(CI)) + if (!isa<DbgInfoIntrinsic>(CI) && !CI->isLifetimeStartOrEnd()) return true; } else if (isa<InvokeInst>(U)) { return true; |