[PATCH] D19969: [scan-build] fix warnings emitted on LLVM NVPTX code baseFix logic error warnings of the type "called C++ object pointer isnull" emitted by Clang Static Analyzer on the following file:lib/Target/NVPTX/NVPTXInstrInfo.cpp.

Apelete Seketeli via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 06:34:34 PDT 2016


apelete created this revision.
apelete added reviewers: jlebar, jholewinski.
apelete added a subscriber: llvm-commits.
Herald added a subscriber: jholewinski.

Signed-off-by: Apelete Seketeli <apelete at seketeli.net>

http://reviews.llvm.org/D19969

Files:
  lib/Target/NVPTX/NVPTXInstrInfo.cpp

Index: lib/Target/NVPTX/NVPTXInstrInfo.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXInstrInfo.cpp
+++ lib/Target/NVPTX/NVPTXInstrInfo.cpp
@@ -179,7 +179,7 @@
     return true;
 
   // If the block ends with NVPTX::GOTO and NVPTX:CBranch, handle it.
-  if (SecondLastInst->getOpcode() == NVPTX::CBranch &&
+  if (SecondLastInst && SecondLastInst->getOpcode() == NVPTX::CBranch &&
       LastInst->getOpcode() == NVPTX::GOTO) {
     TBB = SecondLastInst->getOperand(1).getMBB();
     Cond.push_back(SecondLastInst->getOperand(0));
@@ -189,7 +189,7 @@
 
   // If the block ends with two NVPTX:GOTOs, handle it.  The second one is not
   // executed, so remove it.
-  if (SecondLastInst->getOpcode() == NVPTX::GOTO &&
+  if (SecondLastInst && SecondLastInst->getOpcode() == NVPTX::GOTO &&
       LastInst->getOpcode() == NVPTX::GOTO) {
     TBB = SecondLastInst->getOperand(0).getMBB();
     I = LastInst;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19969.56277.patch
Type: text/x-patch
Size: 955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160505/226d4c20/attachment.bin>


More information about the llvm-commits mailing list