diff options
author | Dan Gohman <gohman@apple.com> | 2008-08-22 16:07:55 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-08-22 16:07:55 +0000 |
commit | 14714cb4fa932a07bc5100b973af358533c87956 (patch) | |
tree | d517c5fa254fe7e90d7a1bf424bd769b8200566d | |
parent | 87fc5a5e6b9c021dc8e6aaa6c80d218ac4ea1970 (diff) | |
download | bcm5719-llvm-14714cb4fa932a07bc5100b973af358533c87956.tar.gz bcm5719-llvm-14714cb4fa932a07bc5100b973af358533c87956.zip |
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.
llvm-svn: 55181
-rw-r--r-- | llvm/include/llvm/ADT/SmallVector.h | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/CodeGen/IfConversion.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 05952a4490e..fdecb6c4481 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -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. diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index c97f176d74b..2ccfd191a09 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -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, diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index d98b0ceb2dd..079b7016480 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -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); } |