[llvm] r361095 - MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat May 18 04:31:48 PDT 2019
Author: rksimon
Date: Sat May 18 04:31:48 2019
New Revision: 361095
URL: http://llvm.org/viewvc/llvm-project?rev=361095&view=rev
Log:
MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI.
Fix scan-build uninitialized warning and assert the final diff isn't null.
Modified:
llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp
Modified: llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp?rev=361095&r1=361094&r2=361095&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp (original)
+++ llvm/trunk/lib/CodeGen/ExpandMemCmp.cpp Sat May 18 04:31:48 2019
@@ -323,7 +323,7 @@ Value *MemCmpExpansion::getCompareLoadPa
assert(LoadIndex < getNumLoads() &&
"getCompareLoadPairs() called with no remaining loads");
std::vector<Value *> XorList, OrList;
- Value *Diff;
+ Value *Diff = nullptr;
const unsigned NumLoads =
std::min(getNumLoads() - LoadIndex, NumLoadsPerBlockForZeroCmp);
@@ -400,6 +400,8 @@ Value *MemCmpExpansion::getCompareLoadPa
while (OrList.size() != 1) {
OrList = pairWiseOr(OrList);
}
+
+ assert(Diff && "Failed to find comparison diff");
Cmp = Builder.CreateICmpNE(OrList[0], ConstantInt::get(Diff->getType(), 0));
}
More information about the llvm-commits
mailing list