[PATCH] D113164: [NFC] Avoid nullptr dereference
Freddy, Ye via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 19:38:22 PDT 2021
FreddyYe created this revision.
Herald added a subscriber: hiraditya.
FreddyYe requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
These warning are reported by static code analysis tool: Klocwork
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113164
Files:
llvm/lib/CodeGen/TypePromotion.cpp
Index: llvm/lib/CodeGen/TypePromotion.cpp
===================================================================
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -257,7 +257,8 @@
if (auto *Store = dyn_cast<StoreInst>(V))
return LessOrEqualTypeSize(Store->getValueOperand());
if (auto *Return = dyn_cast<ReturnInst>(V))
- return LessOrEqualTypeSize(Return->getReturnValue());
+ if (auto *Val = Return->getReturnValue())
+ return LessOrEqualTypeSize(Val);
if (auto *ZExt = dyn_cast<ZExtInst>(V))
return GreaterThanTypeSize(ZExt);
if (auto *Switch = dyn_cast<SwitchInst>(V))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113164.384642.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/1184a390/attachment.bin>
More information about the llvm-commits
mailing list