mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user