aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2021-04-20 15:01:55 -0700
committerPhilip Reames <listmail@philipreames.com>2021-04-20 15:03:49 -0700
commitd87b9b81ccb95217181ce75515c6c68bbb408ca4 (patch)
treeb8bd9cdb998a28de89e67d36a69570d0d09c180b /llvm/lib/CodeGen/StackProtector.cpp
parent080d48f279e2b70e4e9fc65bc4947a53ffc982f3 (diff)
downloadllvm-d87b9b81ccb95217181ce75515c6c68bbb408ca4.zip
llvm-d87b9b81ccb95217181ce75515c6c68bbb408ca4.tar.gz
llvm-d87b9b81ccb95217181ce75515c6c68bbb408ca4.tar.bz2
Allow invokable sub-classes of IntrinsicInst
It used to be that all of our intrinsics were call instructions, but over time, we've added more and more invokable intrinsics. According to the verifier, we're up to 8 right now. As IntrinsicInst is a sub-class of CallInst, this puts us in an awkward spot where the idiomatic means to check for intrinsic has a false negative if the intrinsic is invoked. This change switches IntrinsicInst from being a sub-class of CallInst to being a subclass of CallBase. This allows invoked intrinsics to be instances of IntrinsicInst, at the cost of requiring a few more casts to CallInst in places where the intrinsic really is known to be a call, not an invoke. After this lands and has baked for a couple days, planned cleanups: Make GCStatepointInst a IntrinsicInst subclass. Merge intrinsic handling in InstCombine and use idiomatic visitIntrinsicInst entry point for InstVisitor. Do the same in SelectionDAG. Do the same in FastISEL. Differential Revision: https://reviews.llvm.org/D99976
Diffstat (limited to 'llvm/lib/CodeGen/StackProtector.cpp')
-rw-r--r--llvm/lib/CodeGen/StackProtector.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp
index ff6ff6d..b0629b3 100644
--- a/llvm/lib/CodeGen/StackProtector.cpp
+++ b/llvm/lib/CodeGen/StackProtector.cpp
@@ -255,7 +255,7 @@ static const CallInst *findStackProtectorIntrinsic(Function &F) {
for (const Instruction &I : BB)
if (const auto *II = dyn_cast<IntrinsicInst>(&I))
if (II->getIntrinsicID() == Intrinsic::stackprotector)
- return II;
+ return cast<CallInst>(II);
return nullptr;
}