[llvm-commits] [llvm] r55181 - in /llvm/trunk: include/llvm/ADT/SmallVector.h lib/CodeGen/BranchFolding.cpp lib/CodeGen/IfConversion.cpp

Dan Gohman gohman at apple.com
Fri Aug 22 09:07:55 PDT 2008


Author: djg
Date: Fri Aug 22 11:07:55 2008
New Revision: 55181

URL: http://llvm.org/viewvc/llvm-project?rev=55181&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/ADT/SmallVector.h
    llvm/trunk/lib/CodeGen/BranchFolding.cpp
    llvm/trunk/lib/CodeGen/IfConversion.cpp

Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=55181&r1=55180&r2=55181&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Fri Aug 22 11:07:55 2008
@@ -477,7 +477,7 @@
     // 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.

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=55181&r1=55180&r2=55181&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Fri Aug 22 11:07:55 2008
@@ -364,7 +364,7 @@
 
   // 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 @@
       }
     }
   }
-  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,

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=55181&r1=55180&r2=55181&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Fri Aug 22 11:07:55 2008
@@ -815,7 +815,7 @@
 ///
 static void InsertUncondBranch(MachineBasicBlock *BB, MachineBasicBlock *ToBB,
                                const TargetInstrInfo *TII) {
-  SmallVector<MachineOperand, 1> NoCond;
+  SmallVector<MachineOperand, 0> NoCond;
   TII->InsertBranch(*BB, ToBB, NULL, NoCond);
 }
 





More information about the llvm-commits mailing list