[llvm] r373823 - BranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 5 06:20:30 PDT 2019


Author: rksimon
Date: Sat Oct  5 06:20:30 2019
New Revision: 373823

URL: http://llvm.org/viewvc/llvm-project?rev=373823&view=rev
Log:
BranchFolding - IsBetterFallthrough - assert non-null pointers. NFCI.

Silences static analyzer null dereference warnings.

Modified:
    llvm/trunk/lib/CodeGen/BranchFolding.cpp

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=373823&r1=373822&r2=373823&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Sat Oct  5 06:20:30 2019
@@ -1307,6 +1307,8 @@ static bool IsBranchOnlyBlock(MachineBas
 /// result in infinite loops.
 static bool IsBetterFallthrough(MachineBasicBlock *MBB1,
                                 MachineBasicBlock *MBB2) {
+  assert(MBB1 && MBB2 && "Unknown MachineBasicBlock");
+
   // Right now, we use a simple heuristic.  If MBB2 ends with a call, and
   // MBB1 doesn't, we prefer to fall through into MBB1.  This allows us to
   // optimize branches that branch to either a return block or an assert block




More information about the llvm-commits mailing list