aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/ExpandMemCmp.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2019-05-18 11:31:48 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2019-05-18 11:31:48 +0000
commit2b45a70fd6d1f95886b3194ae13422e3cc00b56a (patch)
tree4fa3a50d18207d384ac7b54913c2d661b840caf8 /llvm/lib/CodeGen/ExpandMemCmp.cpp
parent63621832da65543c611fb839daac6b95ae9829f6 (diff)
downloadllvm-2b45a70fd6d1f95886b3194ae13422e3cc00b56a.zip
llvm-2b45a70fd6d1f95886b3194ae13422e3cc00b56a.tar.gz
llvm-2b45a70fd6d1f95886b3194ae13422e3cc00b56a.tar.bz2
MemCmpExpansion::getCompareLoadPairs - assert we find a comparison diff. NFCI.
Fix scan-build uninitialized warning and assert the final diff isn't null. llvm-svn: 361095
Diffstat (limited to 'llvm/lib/CodeGen/ExpandMemCmp.cpp')
-rw-r--r--llvm/lib/CodeGen/ExpandMemCmp.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/ExpandMemCmp.cpp b/llvm/lib/CodeGen/ExpandMemCmp.cpp
index a3a9790..06c171a 100644
--- a/llvm/lib/CodeGen/ExpandMemCmp.cpp
+++ b/llvm/lib/CodeGen/ExpandMemCmp.cpp
@@ -323,7 +323,7 @@ Value *MemCmpExpansion::getCompareLoadPairs(unsigned BlockIndex,
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::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));
}