[PATCH] D145463: [Inliner][NFC] Remove redundant nullptr check

Alex MacLean via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 09:30:57 PST 2023


AlexM created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
AlexM edited the summary of this revision.
AlexM edited the summary of this revision.
AlexM added reviewers: mtrofin, kazu.
AlexM published this revision for review.
AlexM added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I'm very new to this and trying to get my toes wet in the review process with some very minor non-controversial changes. Please let me know if I've made any mistakes in the process.


Remove the null pointer check on Callee since it is guaranteed to pass by the check
at the top of the loop which continues if Callee is null. While this change is somewhat
trivial, for what it's worth this check triggers Coverity warnings because it implies that
Callee might be null at this point even though it is dereferenced in the preceding code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145463

Files:
  llvm/lib/Transforms/IPO/Inliner.cpp


Index: llvm/lib/Transforms/IPO/Inliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/Inliner.cpp
+++ llvm/lib/Transforms/IPO/Inliner.cpp
@@ -555,7 +555,7 @@
 
       // If we inlined or deleted the last possible call site to the function,
       // delete the function body now.
-      if (Callee && Callee->use_empty() && Callee->hasLocalLinkage() &&
+      if (Callee->use_empty() && Callee->hasLocalLinkage() &&
           // TODO: Can remove if in SCC now.
           !SCCFunctions.count(Callee) &&
           // The function may be apparently dead, but if there are indirect


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145463.502907.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/25353780/attachment.bin>


More information about the llvm-commits mailing list