[llvm] r372518 - [LSR] Silence static analyzer null dereference warnings with assertions. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 10:59:24 PDT 2019


Author: rksimon
Date: Sun Sep 22 10:59:24 2019
New Revision: 372518

URL: http://llvm.org/viewvc/llvm-project?rev=372518&view=rev
Log:
[LSR] Silence static analyzer null dereference warnings with assertions. NFCI.

Add assertions to make it clear that GenerateIVChain / NarrowSearchSpaceByPickingWinnerRegs should succeed in finding non-null values

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=372518&r1=372517&r2=372518&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Sep 22 10:59:24 2019
@@ -3165,6 +3165,7 @@ void LSRInstance::GenerateIVChain(const
     LLVM_DEBUG(dbgs() << "Concealed chain head: " << *Head.UserInst << "\n");
     return;
   }
+  assert(IVSrc && "Failed to find IV chain source");
 
   LLVM_DEBUG(dbgs() << "Generate chain at: " << *IVSrc << "\n");
   Type *IVTy = IVSrc->getType();
@@ -4835,6 +4836,7 @@ void LSRInstance::NarrowSearchSpaceByPic
         }
       }
     }
+    assert(Best && "Failed to find best LSRUse candidate");
 
     LLVM_DEBUG(dbgs() << "Narrowing the search space by assuming " << *Best
                       << " will yield profitable reuse.\n");




More information about the llvm-commits mailing list