[llvm] 870f691 - Fix "pointer is null" static analyzer warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 03:11:40 PST 2020


Author: Simon Pilgrim
Date: 2020-01-10T11:10:42Z
New Revision: 870f6917936fdb8050be3ca3c67d9259390c4326

URL: https://github.com/llvm/llvm-project/commit/870f6917936fdb8050be3ca3c67d9259390c4326
DIFF: https://github.com/llvm/llvm-project/commit/870f6917936fdb8050be3ca3c67d9259390c4326.diff

LOG: Fix "pointer is null" static analyzer warnings. NFCI.

Assert that the pointers are non-null before dereferencing them.

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
index b18730d967a3..d0285a7aa377 100644
--- a/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp
@@ -282,6 +282,7 @@ bool HexagonEarlyIfConversion::matchFlowPattern(MachineBasicBlock *B,
   // can fall through into the other, in other words, it will be executed
   // in both cases. We only want to predicate the block that is executed
   // conditionally.
+  assert(TB && FB && "Failed to find triangle control flow blocks");
   unsigned TNP = TB->pred_size(), FNP = FB->pred_size();
   unsigned TNS = TB->succ_size(), FNS = FB->succ_size();
 


        


More information about the llvm-commits mailing list