From: Simon Pilgrim Date: Sat, 18 May 2019 11:31:48 +0000 (+0000) Subject: MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI. X-Git-Tag: android-x86-9.0-r1~3246 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=a77280973d22b32ebd0e244ad4649946f71fa778;p=android-x86%2Fexternal-llvm.git MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI. Fix scan-build uninitialized warning and assert the final diff isn't null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361095 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/ExpandMemCmp.cpp b/lib/CodeGen/ExpandMemCmp.cpp index a3a979008dc..06c171a457b 100644 --- a/lib/CodeGen/ExpandMemCmp.cpp +++ b/lib/CodeGen/ExpandMemCmp.cpp @@ -323,7 +323,7 @@ Value *MemCmpExpansion::getCompareLoadPairs(unsigned BlockIndex, assert(LoadIndex < getNumLoads() && "getCompareLoadPairs() called with no remaining loads"); std::vector XorList, OrList; - Value *Diff; + Value *Diff = nullptr; const unsigned NumLoads = std::min(getNumLoads() - LoadIndex, NumLoadsPerBlockForZeroCmp); @@ -400,6 +400,8 @@ Value *MemCmpExpansion::getCompareLoadPairs(unsigned BlockIndex, while (OrList.size() != 1) { OrList = pairWiseOr(OrList); } + + assert(Diff && "Failed to find comparison diff"); Cmp = Builder.CreateICmpNE(OrList[0], ConstantInt::get(Diff->getType(), 0)); }