[llvm] r324323 - [MergeICmps][NFC] Add more assertions.
Clement Courbet via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 6 01:14:01 PST 2018
Author: courbet
Date: Tue Feb 6 01:14:00 2018
New Revision: 324323
URL: http://llvm.org/viewvc/llvm-project?rev=324323&view=rev
Log:
[MergeICmps][NFC] Add more assertions.
Modified:
llvm/trunk/lib/Transforms/Scalar/MergeICmps.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/MergeICmps.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MergeICmps.cpp?rev=324323&r1=324322&r2=324323&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MergeICmps.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MergeICmps.cpp Tue Feb 6 01:14:00 2018
@@ -275,9 +275,11 @@ class BCECmpChain {
BCECmpChain::BCECmpChain(const std::vector<BasicBlock *> &Blocks, PHINode &Phi)
: Phi_(Phi) {
+ assert(!Blocks.empty() && "a chain should have at least one block");
// Now look inside blocks to check for BCE comparisons.
std::vector<BCECmpBlock> Comparisons;
for (BasicBlock *Block : Blocks) {
+ assert(Block && "invalid block");
BCECmpBlock Comparison = visitCmpBlock(Phi.getIncomingValueForBlock(Block),
Block, Phi.getParent());
Comparison.BB = Block;
@@ -328,6 +330,7 @@ BCECmpChain::BCECmpChain(const std::vect
DEBUG(dbgs() << "\n");
Comparisons.push_back(Comparison);
}
+ assert(!Comparisons.empty() && "chain with a single complex basic block");
EntryBlock_ = Comparisons[0].BB;
Comparisons_ = std::move(Comparisons);
#ifdef MERGEICMPS_DOT_ON
@@ -507,6 +510,7 @@ std::vector<BasicBlock *> getOrderedBloc
int NumBlocks) {
// Walk up from the last block to find other blocks.
std::vector<BasicBlock *> Blocks(NumBlocks);
+ assert(LastBlock && "invalid last block");
BasicBlock *CurBlock = LastBlock;
for (int BlockIndex = NumBlocks - 1; BlockIndex > 0; --BlockIndex) {
if (CurBlock->hasAddressTaken()) {
More information about the llvm-commits
mailing list