diff options
Diffstat (limited to 'llvm/lib/Analysis/StackLifetime.cpp')
-rw-r--r-- | llvm/lib/Analysis/StackLifetime.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/StackLifetime.cpp b/llvm/lib/Analysis/StackLifetime.cpp index 34a7a04..b3f9994 100644 --- a/llvm/lib/Analysis/StackLifetime.cpp +++ b/llvm/lib/Analysis/StackLifetime.cpp @@ -63,7 +63,10 @@ bool StackLifetime::isAliveAfter(const AllocaInst *AI, // markers has the same size and points to the alloca start. static const AllocaInst *findMatchingAlloca(const IntrinsicInst &II, const DataLayout &DL) { - const AllocaInst *AI = cast<AllocaInst>(II.getArgOperand(1)); + const AllocaInst *AI = dyn_cast<AllocaInst>(II.getArgOperand(1)); + if (!AI) + return nullptr; + auto AllocaSize = AI->getAllocationSize(DL); if (!AllocaSize) return nullptr; |