Fix SmallVector's size calculation so that a size of 0 is

handled correctly, and change a few SmallVector uses to use
size 0 to more clearly reflect their intent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55181 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-08-22 16:07:55 +00:00
parent 969a46a948
commit 1501cdbf63
3 changed files with 4 additions and 4 deletions

View File

@ -477,7 +477,7 @@ class SmallVector : public SmallVectorImpl<T> {
// NumInlineEltsElts - The number of elements actually in this array. There
// is already one in the parent class, and we have to round up to avoid
// having a zero-element array.
NumInlineEltsElts = (MinUs - 1) > 0 ? (MinUs - 1) : 1,
NumInlineEltsElts = MinUs > 1 ? (MinUs - 1) : 1,
// NumTsAvailable - The number of T's we actually have space for, which may
// be more than N due to rounding.

View File

@ -364,7 +364,7 @@ void BranchFolder::ReplaceTailWithBranchTo(MachineBasicBlock::iterator OldInst,
// If OldBB isn't immediately before OldBB, insert a branch to it.
if (++MachineFunction::iterator(OldBB) != MachineFunction::iterator(NewDest))
TII->InsertBranch(*OldBB, NewDest, 0, SmallVector<MachineOperand, 1>());
TII->InsertBranch(*OldBB, NewDest, 0, SmallVector<MachineOperand, 0>());
OldBB->addSuccessor(NewDest);
++NumTailMerge;
}
@ -444,7 +444,7 @@ static void FixTail(MachineBasicBlock* CurMBB, MachineBasicBlock *SuccBB,
}
}
}
TII->InsertBranch(*CurMBB, SuccBB, NULL, SmallVector<MachineOperand, 1>());
TII->InsertBranch(*CurMBB, SuccBB, NULL, SmallVector<MachineOperand, 0>());
}
static bool MergeCompare(const std::pair<unsigned,MachineBasicBlock*> &p,

View File

@ -815,7 +815,7 @@ void IfConverter::InvalidatePreds(MachineBasicBlock *BB) {
///
static void InsertUncondBranch(MachineBasicBlock *BB, MachineBasicBlock *ToBB,
const TargetInstrInfo *TII) {
SmallVector<MachineOperand, 1> NoCond;
SmallVector<MachineOperand, 0> NoCond;
TII->InsertBranch(*BB, ToBB, NULL, NoCond);
}