[llvm-commits] [poolalloc] r40814 - /poolalloc/branches/SVA/lib/DSA/Local.cpp

2007-08-04 Thread John Criswell
Author: criswell
Date: Sat Aug  4 11:23:46 2007
New Revision: 40814

URL: http://llvm.org/viewvc/llvm-project?rev=40814&view=rev
Log:
Added assertion.

Modified:
poolalloc/branches/SVA/lib/DSA/Local.cpp

Modified: poolalloc/branches/SVA/lib/DSA/Local.cpp
URL: 
http://llvm.org/viewvc/llvm-project/poolalloc/branches/SVA/lib/DSA/Local.cpp?rev=40814&r1=40813&r2=40814&view=diff

==
--- poolalloc/branches/SVA/lib/DSA/Local.cpp (original)
+++ poolalloc/branches/SVA/lib/DSA/Local.cpp Sat Aug  4 11:23:46 2007
@@ -1517,6 +1517,7 @@
 assert (isa(CS.getArgument(0)) && "llva_syscall6 called with 
non-const argument");
 ConstantInt * C = dyn_cast(CS.getArgument(0));
 Callee = syscalls[C->getSExtValue()];
+assert (Callee && "llva_syscall: No target for system call vector");
   }
 
   // Set up the return value...


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40815 - /llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp

2007-08-04 Thread Nick Lewycky
Author: nicholas
Date: Sat Aug  4 13:45:32 2007
New Revision: 40815

URL: http://llvm.org/viewvc/llvm-project?rev=40815&view=rev
Log:
Clean up comments, fix up some confusing code logic.
Predsimplify fails llvm-gcc bootstrap.

Modified:
llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=40815&r1=40814&r2=40815&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Aug  4 
13:45:32 2007
@@ -70,8 +70,7 @@
 //
 // The ValueRanges class stores the known integer bounds of a Value. When we
 // encounter i8 %a u< %b, the ValueRanges stores that %a = [1, 255] and
-// %b = [0, 254]. Because we store these by Value*, you should always
-// canonicalize through the InequalityGraph first.
+// %b = [0, 254].
 //
 // It never stores an empty range, because that means that the code is
 // unreachable. It never stores a single-element range since that's an equality
@@ -342,6 +341,8 @@
 UGE = UGT | EQ_BIT
   };
 
+  /// validPredicate - determines whether a given value is actually a lattice
+  /// value. Only used in assertions or debugging.
   static bool validPredicate(LatticeVal LV) {
 switch (LV) {
   case GT: case GE: case LT: case LE: case NE:
@@ -372,6 +373,10 @@
 
   /// ValueNumbering stores the scope-specific value numbers for a given Value.
   class VISIBILITY_HIDDEN ValueNumbering {
+
+/// VNPair is a tuple of {Value, index number, DomTreeDFS::Node}. It
+/// includes the comparison operators necessary to allow you to store it
+/// in a sorted vector.
 class VISIBILITY_HIDDEN VNPair {
 public:
   Value *V;
@@ -393,11 +398,20 @@
   bool operator<(Value *RHS) const {
 return V < RHS;
   }
+
+  bool operator>(Value *RHS) const {
+return V > RHS;
+  }
+
+  friend bool operator<(Value *RHS, const VNPair &pair) {
+return pair.operator>(RHS);
+  }
 };
 
 typedef std::vector VNMapType;
 VNMapType VNMap;
 
+/// The canonical choice for value number at index.
 std::vector Values;
 
 DomTreeDFS *DTDFS;
@@ -680,41 +694,44 @@
 return E;
   }
 
-  /// Updates the lattice value for a given node. Create a new entry if
-  /// one doesn't exist, otherwise it merges the values. The new lattice
-  /// value must not be inconsistent with any previously existing value.
+  /// update - updates the lattice value for a given node, creating a new
+  /// entry if one doesn't exist. The new lattice value must not be
+  /// inconsistent with any previously existing value.
   void update(unsigned n, LatticeVal R, DomTreeDFS::Node *Subtree) {
 assert(validPredicate(R) && "Invalid predicate.");
-iterator I = find(n, Subtree);
-if (I == end()) {
-  Edge edge(n, R, Subtree);
-  iterator Insert = std::lower_bound(begin(), end(), edge);
-  Relations.insert(Insert, edge);
-} else {
-  LatticeVal LV = static_cast(I->LV & R);
-  assert(validPredicate(LV) && "Invalid union of lattice values.");
-  if (LV != I->LV) {
-if (Subtree != I->Subtree) {
-  assert(Subtree->DominatedBy(I->Subtree) &&
- "Find returned subtree that doesn't apply.");
-
-  Edge edge(n, R, Subtree);
-  iterator Insert = std::lower_bound(begin(), end(), edge);
-  Relations.insert(Insert, edge); // invalidates I
-  I = find(n, Subtree);
-}
-
-// Also, we have to tighten any edge that Subtree dominates.
-for (iterator B = begin(); I->To == n; --I) {
-  if (I->Subtree->DominatedBy(Subtree)) {
-LatticeVal LV = static_cast(I->LV & R);
+
+Edge edge(n, R, Subtree);
+iterator B = begin(), E = end();
+iterator I = std::lower_bound(B, E, edge);
+
+iterator J = I;
+while (J != E && J->To == n) {
+  if (Subtree->DominatedBy(J->Subtree))
+break;
+  ++J;
+}
+
+if (J != E && J->To == n && J->Subtree->dominates(Subtree)) {
+  edge.LV = static_cast(J->LV & R);
+  assert(validPredicate(edge.LV) && "Invalid union of lattice 
values.");
+  if (edge.LV != J->LV) {
+
+// We have to tighten any edge beneath our update.
+for (iterator K = I; K->To == n; --K) {
+  if (K->Subtree->DominatedBy(Subtree)) {
+LatticeVal LV = static_cast(K->LV & edge.LV);
 assert(validPredicate(LV) && "Invalid union of lattice 
values");
-I->LV = LV;
+K->LV = LV;
   }
-  if (I == B

[llvm-commits] [llvm] r40816 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 14:52:20 2007
New Revision: 40816

URL: http://llvm.org/viewvc/llvm-project?rev=40816&view=rev
Log:
std::map -> DenseMap

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40816&r1=40815&r2=40816&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
14:52:20 2007
@@ -702,7 +702,7 @@
 /// alloca which is locally used in it (which might be a lot).
 void PromoteMem2Reg::
 PromoteLocallyUsedAllocas(BasicBlock *BB, const std::vector &AIs) 
{
-  std::map CurValues;
+  DenseMap CurValues;
   for (unsigned i = 0, e = AIs.size(); i != e; ++i)
 CurValues[AIs[i]] = 0; // Insert with null value
 
@@ -711,7 +711,7 @@
 if (LoadInst *LI = dyn_cast(Inst)) {
   // Is this a load of an alloca we are tracking?
   if (AllocaInst *AI = dyn_cast(LI->getOperand(0))) {
-std::map::iterator AIt = CurValues.find(AI);
+DenseMap::iterator AIt = CurValues.find(AI);
 if (AIt != CurValues.end()) {
   // If loading an uninitialized value, allow the inter-block case to
   // handle it.  Due to control flow, this might actually be ok.
@@ -730,7 +730,7 @@
   }
 } else if (StoreInst *SI = dyn_cast(Inst)) {
   if (AllocaInst *AI = dyn_cast(SI->getOperand(1))) {
-std::map::iterator AIt = CurValues.find(AI);
+DenseMap::iterator AIt = CurValues.find(AI);
 if (AIt != CurValues.end()) {
   // Store updates the "current value"...
   AIt->second = SI->getOperand(0);


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40817 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:01:43 2007
New Revision: 40817

URL: http://llvm.org/viewvc/llvm-project?rev=40817&view=rev
Log:
When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40817&r1=40816&r2=40817&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:01:43 2007
@@ -686,10 +686,10 @@
   }
 
   // After traversing the basic block, there should be no more uses of the
-  // alloca, remove it now.
+  // alloca: remove it now.
   assert(AI->use_empty() && "Uses of alloca from more than one BB??");
   if (AST) AST->deleteValue(AI);
-  AI->getParent()->getInstList().erase(AI);
+  AI->eraseFromParent();
   
   ++NumLocalPromoted;
   return false;
@@ -739,6 +739,17 @@
   }
 }
   }
+  
+  // At the end of the block scan, all allocas in CurValues are dead.
+  for (DenseMap::iterator I = CurValues.begin(),
+   E = CurValues.end(); I != E; ++I) {
+AllocaInst *AI = I->first;
+assert(AI->use_empty() && "Uses of alloca from more than one BB??");
+if (AST) AST->deleteValue(AI);
+AI->eraseFromParent();
+  }
+
+  NumLocalPromoted += CurValues.size();
 }
 
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40818 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:03:23 2007
New Revision: 40818

URL: http://llvm.org/viewvc/llvm-project?rev=40818&view=rev
Log:
Promoting allocas with the 'single store' fastpath is 
faster than with the 'local to a block' fastpath.  This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)


Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40818&r1=40817&r2=40818&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:03:23 2007
@@ -273,16 +273,6 @@
 // analogous to finding the 'uses' and 'definitions' of each variable.
 Info.AnalyzeAlloca(AI);
 
-// If the alloca is only read and written in one basic block, just perform 
a
-// linear sweep over the block to eliminate it.
-if (Info.OnlyUsedInOneBlock) {
-  LocallyUsedAllocas[Info.OnlyBlock].push_back(AI);
-
-  // Remove the alloca from the Allocas list, since it will be processed.
-  RemoveFromAllocasList(AllocaNum);
-  continue;
-}
-
 // If there is only a single store to this value, replace any loads of
 // it that are directly dominated by the definition with the value stored.
 if (Info.DefiningBlocks.size() == 1) {
@@ -303,6 +293,15 @@
   }
 }
 
+// If the alloca is only read and written in one basic block, just perform 
a
+// linear sweep over the block to eliminate it.
+if (Info.OnlyUsedInOneBlock) {
+  LocallyUsedAllocas[Info.OnlyBlock].push_back(AI);
+  
+  // Remove the alloca from the Allocas list, since it will be processed.
+  RemoveFromAllocasList(AllocaNum);
+  continue;
+}
 
 if (AST)
   PointerAllocaValues[AllocaNum] = Info.AllocaPointerVal;


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40819 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:07:06 2007
New Revision: 40819

URL: http://llvm.org/viewvc/llvm-project?rev=40819&view=rev
Log:
use continue to avoid nesting, no functionality change.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40819&r1=40818&r2=40819&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:07:06 2007
@@ -611,20 +611,21 @@
 BasicBlock *DomBB = IDom->getBlock();
 DenseMap, PHINode*>::iterator
   I = NewPhiNodes.find(std::make_pair(DomBB, AllocaNum));
-if (I != NewPhiNodes.end()) {
-  // Ok, we found an inserted PHI node which dominates this value.
-  PHINode *DominatingPHI = I->second;
-
-  // Find out if we previously thought it was dead.  If so, mark it as 
being
-  // live by removing it from the DeadPHINodes set.
-  if (DeadPHINodes.erase(DominatingPHI)) {
-// Now that we have marked the PHI node alive, also mark any PHI nodes
-// which it might use as being alive as well.
-for (pred_iterator PI = pred_begin(DomBB), PE = pred_end(DomBB);
- PI != PE; ++PI)
-  MarkDominatingPHILive(*PI, AllocaNum, DeadPHINodes);
-  }
-}
+if (I == NewPhiNodes.end()) continue;
+
+// Ok, we found an inserted PHI node which dominates this value.
+PHINode *DominatingPHI = I->second;
+
+// Find out if we previously thought it was dead.  If so, mark it as being
+// live by removing it from the DeadPHINodes set.
+if (!DeadPHINodes.erase(DominatingPHI))
+  continue;
+
+// Now that we have marked the PHI node alive, also mark any PHI nodes
+// which it might use as being alive as well.
+for (pred_iterator PI = pred_begin(DomBB), PE = pred_end(DomBB);
+ PI != PE; ++PI)
+  MarkDominatingPHILive(*PI, AllocaNum, DeadPHINodes);
   }
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40820 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:14:34 2007
New Revision: 40820

URL: http://llvm.org/viewvc/llvm-project?rev=40820&view=rev
Log:
reserve operand space for phi nodes when we insert them.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40820&r1=40819&r2=40820&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:14:34 2007
@@ -772,6 +772,7 @@
Allocas[AllocaNo]->getName() + "." +
utostr(Version++), BB->begin());
   PhiToAllocaMap[PN] = AllocaNo;
+  PN->reserveOperandSpace(std::distance(pred_begin(BB), pred_end(BB)));
   
   InsertedPHINodes.insert(PN);
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40821 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:24:50 2007
New Revision: 40821

URL: http://llvm.org/viewvc/llvm-project?rev=40821&view=rev
Log:
cache computation of #preds for a BB.  This speeds up
mem2reg from 2.0742->2.0522s on PR1432.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40821&r1=40820&r2=40821&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:24:50 2007
@@ -137,6 +137,8 @@
 /// non-determinstic behavior.
 DenseMap BBNumbers;
 
+/// BBNumPreds - Lazily compute the number of predecessors a block has.
+DenseMap BBNumPreds;
   public:
 PromoteMem2Reg(const std::vector &A,
SmallVector &Retry, DominatorTree &dt,
@@ -165,6 +167,14 @@
   Allocas.pop_back();
   --AllocaIdx;
 }
+
+unsigned getNumPreds(const BasicBlock *BB) {
+  unsigned &NP = BBNumPreds[BB];
+  if (NP == 0)
+NP = std::distance(pred_begin(BB), pred_end(BB))+1;
+  return NP-1;
+}
+
 
 void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info);
 
@@ -209,7 +219,7 @@
   // and decide whether all of the loads and stores to the alloca are 
within
   // the same basic block.
   for (Value::use_iterator U = AI->use_begin(), E = AI->use_end();
-   U != E; ++U){
+   U != E; ++U) {
 Instruction *User = cast(*U);
 if (StoreInst *SI = dyn_cast(User)) {
   // Remember the basic blocks which define new values for the alloca
@@ -218,7 +228,8 @@
   OnlyStore = SI;
 } else {
   LoadInst *LI = cast(User);
-  // Otherwise it must be a load instruction, keep track of variable 
reads
+  // Otherwise it must be a load instruction, keep track of variable
+  // reads.
   UsingBlocks.push_back(LI->getParent());
   AllocaPointerVal = LI;
 }
@@ -772,7 +783,7 @@
Allocas[AllocaNo]->getName() + "." +
utostr(Version++), BB->begin());
   PhiToAllocaMap[PN] = AllocaNo;
-  PN->reserveOperandSpace(std::distance(pred_begin(BB), pred_end(BB)));
+  PN->reserveOperandSpace(getNumPreds(BB));
   
   InsertedPHINodes.insert(PN);
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40822 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 15:40:27 2007
New Revision: 40822

URL: http://llvm.org/viewvc/llvm-project?rev=40822&view=rev
Log:
Change the rename pass to be "tail recursive", only adding N-1 successors
to the worklist, and handling the last one with a 'tail call'.  This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40822&r1=40821&r2=40822&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
15:40:27 2007
@@ -801,6 +801,7 @@
 void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred,
 RenamePassData::ValVector &IncomingVals,
 std::vector &Worklist) {
+NextIteration:
   // If we are inserting any phi nodes into this BB, they will already be in 
the
   // block.
   if (PHINode *APN = dyn_cast(BB->begin())) {
@@ -865,36 +866,49 @@
 Instruction *I = II++; // get the instruction, increment iterator
 
 if (LoadInst *LI = dyn_cast(I)) {
-  if (AllocaInst *Src = dyn_cast(LI->getPointerOperand())) {
-std::map::iterator AI = AllocaLookup.find(Src);
-if (AI != AllocaLookup.end()) {
-  Value *V = IncomingVals[AI->second];
-
-  // walk the use list of this load and replace all uses with r
-  LI->replaceAllUsesWith(V);
-  if (AST && isa(LI->getType()))
-AST->deleteValue(LI);
-  BB->getInstList().erase(LI);
-}
-  }
+  AllocaInst *Src = dyn_cast(LI->getPointerOperand());
+  if (!Src) continue;
+  
+  std::map::iterator AI = AllocaLookup.find(Src);
+  if (AI == AllocaLookup.end()) continue;
+
+  Value *V = IncomingVals[AI->second];
+
+  // Anything using the load now uses the current value.
+  LI->replaceAllUsesWith(V);
+  if (AST && isa(LI->getType()))
+AST->deleteValue(LI);
+  BB->getInstList().erase(LI);
 } else if (StoreInst *SI = dyn_cast(I)) {
   // Delete this instruction and mark the name as the current holder of the
   // value
-  if (AllocaInst *Dest = dyn_cast(SI->getPointerOperand())) {
-std::map::iterator ai = 
AllocaLookup.find(Dest);
-if (ai != AllocaLookup.end()) {
-  // what value were we writing?
-  IncomingVals[ai->second] = SI->getOperand(0);
-  BB->getInstList().erase(SI);
-}
-  }
+  AllocaInst *Dest = dyn_cast(SI->getPointerOperand());
+  if (!Dest) continue;
+  
+  std::map::iterator ai = AllocaLookup.find(Dest);
+  if (ai == AllocaLookup.end())
+continue;
+  
+  // what value were we writing?
+  IncomingVals[ai->second] = SI->getOperand(0);
+  BB->getInstList().erase(SI);
 }
   }
 
-  // Recurse to our successors.
+  // 'Recurse' to our successors.
   TerminatorInst *TI = BB->getTerminator();
-  for (unsigned i = 0; i != TI->getNumSuccessors(); i++)
+  unsigned NumSuccs = TI->getNumSuccessors();
+  if (NumSuccs == 0) return;
+  
+  // Add all-but-one successor to the worklist.
+  for (unsigned i = 0; i != NumSuccs-1; i++)
 Worklist.push_back(RenamePassData(TI->getSuccessor(i), BB, IncomingVals));
+  
+  // Handle the last successor without using the worklist.  This allows us to
+  // handle unconditional branches directly, for example.
+  Pred = BB;
+  BB = TI->getSuccessor(NumSuccs-1);
+  goto NextIteration;
 }
 
 /// PromoteMemToReg - Promote the specified list of alloca instructions into


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40823 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 16:06:15 2007
New Revision: 40823

URL: http://llvm.org/viewvc/llvm-project?rev=40823&view=rev
Log:
Use getNumPreds(BB) instead of computing them manually. This is a very small but
measurable speedup.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40823&r1=40822&r2=40823&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
16:06:15 2007
@@ -496,14 +496,14 @@
 if (&BB->front() != SomePHI)
   continue;
 
-// Count the number of preds for BB.
-SmallVector Preds(pred_begin(BB), pred_end(BB));
-
 // Only do work here if there the PHI nodes are missing incoming values.  
We
 // know that all PHI nodes that were inserted in a block will have the same
 // number of incoming values, so we can just check any of them.
-if (SomePHI->getNumIncomingValues() == Preds.size())
+if (SomePHI->getNumIncomingValues() == getNumPreds(BB))
   continue;
+
+// Get the preds for BB.
+SmallVector Preds(pred_begin(BB), pred_end(BB));
 
 // Ok, now we know that all of the PHI nodes are missing entries for some
 // basic blocks.  Start by sorting the incoming predecessors for efficient


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40824 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 16:14:29 2007
New Revision: 40824

URL: http://llvm.org/viewvc/llvm-project?rev=40824&view=rev
Log:
Factor out a whole bunch of code into it's own method.

Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40824&r1=40823&r2=40824&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
16:14:29 2007
@@ -175,6 +175,8 @@
   return NP-1;
 }
 
+void DetermineInsertionPoint(AllocaInst *AI, unsigned AllocaNum,
+ AllocaInfo &Info);
 
 void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info);
 
@@ -314,9 +316,6 @@
   continue;
 }
 
-if (AST)
-  PointerAllocaValues[AllocaNum] = Info.AllocaPointerVal;
-
 // If we haven't computed a numbering for the BB's in the function, do so
 // now.
 if (BBNumbers.empty()) {
@@ -325,69 +324,19 @@
 BBNumbers[I] = ID++;
 }
 
-// Compute the locations where PhiNodes need to be inserted.  Look at the
-// dominance frontier of EACH basic-block we have a write in.
-//
-unsigned CurrentVersion = 0;
-SmallPtrSet InsertedPHINodes;
-std::vector > DFBlocks;
-while (!Info.DefiningBlocks.empty()) {
-  BasicBlock *BB = Info.DefiningBlocks.back();
-  Info.DefiningBlocks.pop_back();
-
-  // Look up the DF for this write, add it to PhiNodes
-  DominanceFrontier::const_iterator it = DF.find(BB);
-  if (it != DF.end()) {
-const DominanceFrontier::DomSetType &S = it->second;
-
-// In theory we don't need the indirection through the DFBlocks vector.
-// In practice, the order of calling QueuePhiNode would depend on the
-// (unspecified) ordering of basic blocks in the dominance frontier,
-// which would give PHI nodes non-determinstic subscripts.  Fix this by
-// processing blocks in order of the occurance in the function.
-for (DominanceFrontier::DomSetType::const_iterator P = S.begin(),
- PE = S.end(); P != PE; ++P)
-  DFBlocks.push_back(std::make_pair(BBNumbers[*P], *P));
-
-// Sort by which the block ordering in the function.
-std::sort(DFBlocks.begin(), DFBlocks.end());
-
-for (unsigned i = 0, e = DFBlocks.size(); i != e; ++i) {
-  BasicBlock *BB = DFBlocks[i].second;
-  if (QueuePhiNode(BB, AllocaNum, CurrentVersion, InsertedPHINodes))
-Info.DefiningBlocks.push_back(BB);
-}
-DFBlocks.clear();
-  }
-}
-
-// Now that we have inserted PHI nodes along the Iterated Dominance 
Frontier
-// of the writes to the variable, scan through the reads of the variable,
-// marking PHI nodes which are actually necessary as alive (by removing 
them
-// from the InsertedPHINodes set).  This is not perfect: there may PHI
-// marked alive because of loads which are dominated by stores, but there
-// will be no unmarked PHI nodes which are actually used.
-//
-for (unsigned i = 0, e = Info.UsingBlocks.size(); i != e; ++i)
-  MarkDominatingPHILive(Info.UsingBlocks[i], AllocaNum, InsertedPHINodes);
-Info.UsingBlocks.clear();
-
-// If there are any PHI nodes which are now known to be dead, remove them!
-for (SmallPtrSet::iterator I = InsertedPHINodes.begin(),
-   E = InsertedPHINodes.end(); I != E; ++I) {
-  PHINode *PN = *I;
-  bool Erased=NewPhiNodes.erase(std::make_pair(PN->getParent(), 
AllocaNum));
-  Erased=Erased;
-  assert(Erased && "PHI already removed?");
-  
-  if (AST && isa(PN->getType()))
-AST->deleteValue(PN);
-  PN->eraseFromParent();
-  PhiToAllocaMap.erase(PN);
-}
-
-// Keep the reverse mapping of the 'Allocas' array.
+// If we have an AST to keep updated, remember some pointer value that is
+// stored into the alloca.
+if (AST)
+  PointerAllocaValues[AllocaNum] = Info.AllocaPointerVal;
+
+// Keep the reverse mapping of the 'Allocas' array for the rename pass.
 AllocaLookup[Allocas[AllocaNum]] = AllocaNum;
+
+// At this point, we're committed to promoting the alloca using IDF's, and
+// the standard SSA construction algorithm.  Determine which blocks need 
phi
+// nodes and see if we can optimize out some work by avoiding insertion of
+// dead phi nodes.
+DetermineInsertionPoint(AI, AllocaNum, Info);
   }
 
   // Process all allocas which are only used in a single basic block.
@@ -542,6 +491,74 @@
 }
 
 
+/// DetermineInsertionPoint - At this point, we're committed to promoting the
+/// alloca using IDF's, and the standard SSA construction algori

[llvm-commits] [llvm] r40825 - /llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 17:50:14 2007
New Revision: 40825

URL: http://llvm.org/viewvc/llvm-project?rev=40825&view=rev
Log:
rewrite the code used to construct pruned SSA form with the IDF method.
In the old way, we computed and inserted phi nodes for the whole IDF of 
the definitions of the alloca, then computed which ones were dead and
removed them.

In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live.  This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.

This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.


Modified:
llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp

Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=40825&r1=40824&r2=40825&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Sat Aug  4 
17:50:14 2007
@@ -37,6 +37,7 @@
 STATISTIC(NumLocalPromoted, "Number of alloca's promoted within one block");
 STATISTIC(NumSingleStore,   "Number of alloca's promoted with a single store");
 STATISTIC(NumDeadAlloca,"Number of dead alloca's removed");
+STATISTIC(NumPHIInsert, "Number of PHI nodes inserted");
 
 // Provide DenseMapKeyInfo for all pointers.
 namespace llvm {
@@ -177,11 +178,12 @@
 
 void DetermineInsertionPoint(AllocaInst *AI, unsigned AllocaNum,
  AllocaInfo &Info);
+void ComputeLiveInBlocks(AllocaInst *AI, AllocaInfo &Info, 
+ const SmallPtrSet &DefBlocks,
+ SmallPtrSet &LiveInBlocks);
 
 void RewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info);
 
-void MarkDominatingPHILive(BasicBlock *BB, unsigned AllocaNum,
-   SmallPtrSet &DeadPHINodes);
 bool PromoteLocallyUsedAlloca(BasicBlock *BB, AllocaInst *AI);
 void PromoteLocallyUsedAllocas(BasicBlock *BB,
const std::vector &AIs);
@@ -491,12 +493,94 @@
 }
 
 
+/// ComputeLiveInBlocks - Determine which blocks the value is live in.  These
+/// are blocks which lead to uses.  Knowing this allows us to avoid inserting
+/// PHI nodes into blocks which don't lead to uses (thus, the inserted phi 
nodes
+/// would be dead).
+void PromoteMem2Reg::
+ComputeLiveInBlocks(AllocaInst *AI, AllocaInfo &Info, 
+const SmallPtrSet &DefBlocks,
+SmallPtrSet &LiveInBlocks) {
+  
+  // To determine liveness, we must iterate through the predecessors of blocks
+  // where the def is live.  Blocks are added to the worklist if we need to
+  // check their predecessors.  Start with all the using blocks.
+  SmallVector LiveInBlockWorklist;
+  LiveInBlockWorklist.insert(LiveInBlockWorklist.end(), 
+ Info.UsingBlocks.begin(), Info.UsingBlocks.end());
+  
+  // If any of the using blocks is also a definition block, check to see if the
+  // definition occurs before or after the use.  If it happens before the use,
+  // the value isn't really live-in.
+  for (unsigned i = 0, e = LiveInBlockWorklist.size(); i != e; ++i) {
+BasicBlock *BB = LiveInBlockWorklist[i];
+if (!DefBlocks.count(BB)) continue;
+
+// Okay, this is a block that both uses and defines the value.  If the 
first
+// reference to the alloca is a def (store), then we know it isn't live-in.
+for (BasicBlock::iterator I = BB->begin(); ; ++I) {
+  if (StoreInst *SI = dyn_cast(I)) {
+if (SI->getOperand(1) != AI) continue;
+
+// We found a store to the alloca before a load.  The alloca is not
+// actually live-in here.
+LiveInBlockWorklist[i] = LiveInBlockWorklist.back();
+LiveInBlockWorklist.pop_back();
+--i, --e;
+break;
+  } else if (LoadInst *LI = dyn_cast(I)) {
+if (LI->getOperand(0) != AI) continue;
+
+// Okay, we found a load before a store to the alloca.  It is actually
+// live into this block.
+break;
+  }
+}
+  }
+  
+  // Now that we have a set of blocks where the phi is live-in, recursively add
+  // their predecessors until we find the full region the value is live.
+  while (!LiveInBlockWorklist.empty()) {
+BasicBlock *BB = LiveInBlockWorklist.back();
+LiveInBlockWorklist.pop_back();
+
+// The block really is live in here, insert it into the set.  If already in
+// the set, then it has already been processed.
+if (!LiveInBlocks.insert(BB))
+  continue;
+
+// Since the value is live into BB, it is either defined in

[llvm-commits] [llvm] r40826 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h lib/Analysis/PostDominators.cpp lib/VMCore/Dominators.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 18:48:07 2007
New Revision: 40826

URL: http://llvm.org/viewvc/llvm-project?rev=40826&view=rev
Log:
switch the DomTreeNodes and IDoms maps in idom/postidom to a 
DenseMap instead of an std::map.  This speeds up postdomtree
by about 25% and domtree by about 23%.  It also speeds up clients,
for example, domfrontier by 11%, mem2reg by 4% and ADCE by 6%.


Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=40826&r1=40825&r2=40826&view=diff

==
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Sat Aug  4 18:48:07 2007
@@ -23,6 +23,7 @@
 
 #include "llvm/Pass.h"
 #include 
+#include "llvm/ADT/DenseMap.h"
 
 namespace llvm {
 
@@ -103,7 +104,7 @@
 
 protected:
   void reset();
-  typedef std::map DomTreeNodeMapType;
+  typedef DenseMap DomTreeNodeMapType;
   DomTreeNodeMapType DomTreeNodes;
   DomTreeNode *RootNode;
 
@@ -120,7 +121,7 @@
 InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){}
   };
 
-  std::map IDoms;
+  DenseMap IDoms;
 
   // Vertex - Map the DFS number to the BasicBlock*
   std::vector Vertex;
@@ -141,8 +142,8 @@
   /// block.  This is the same as using operator[] on this class.
   ///
   inline DomTreeNode *getNode(BasicBlock *BB) const {
-DomTreeNodeMapType::const_iterator i = DomTreeNodes.find(BB);
-return (i != DomTreeNodes.end()) ? i->second : 0;
+DomTreeNodeMapType::const_iterator I = DomTreeNodes.find(BB);
+return I != DomTreeNodes.end() ? I->second : 0;
   }
 
   inline DomTreeNode *operator[](BasicBlock *BB) const {
@@ -302,9 +303,9 @@
   BasicBlock *Eval(BasicBlock *v);
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
   inline BasicBlock *getIDom(BasicBlock *BB) const {
-  std::map::const_iterator I = IDoms.find(BB);
-  return I != IDoms.end() ? I->second : 0;
-}
+DenseMap::const_iterator I = IDoms.find(BB);
+return I != IDoms.end() ? I->second : 0;
+  }
 };
 
 //===-

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=40826&r1=40825&r2=40826&view=diff

==
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sat Aug  4 18:48:07 2007
@@ -45,7 +45,7 @@
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
 
   inline BasicBlock *getIDom(BasicBlock *BB) const {
-std::map::const_iterator I = IDoms.find(BB);
+DenseMap::const_iterator I = IDoms.find(BB);
 return I != IDoms.end() ? I->second : 0;
   }
 };

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=40826&r1=40825&r2=40826&view=diff

==
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Sat Aug  4 18:48:07 2007
@@ -28,7 +28,7 @@
 F("postdomtree", "Post-Dominator Tree Construction", true);
 
 unsigned PostDominatorTree::DFSPass(BasicBlock *V, InfoRec &VInfo,
-  unsigned N) {
+unsigned N) {
   std::vector > workStack;
   std::set visited;
   workStack.push_back(std::make_pair(V, &VInfo));
@@ -111,13 +111,18 @@
   // Step #0: Scan the function looking for the root nodes of the 
post-dominance
   // relationships.  These blocks, which have no successors, end with return 
and
   // unwind instructions.
-  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
-if (succ_begin(I) == succ_end(I)) {
-  Instruction *Insn = I->getTerminator();
+  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) {
+TerminatorInst *Insn = I->getTerminator();
+if (Insn->getNumSuccessors() == 0) {
   // Unreachable block is not a root node.
   if (!isa(Insn))
 Roots.push_back(I);
 }
+
+// Prepopulate maps so that we don't get iterator invalidation issues 
later.
+IDoms[I] = 0;
+DomTreeNodes[I] = 0;
+  }
   
   Vertex.push_back(0);
   

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=40826&r1=40825&r2=40826&view=diff

==
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sat

[llvm-commits] [llvm] r40827 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h lib/Analysis/PostDominators.cpp lib/VMCore/Dominators.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 19:02:00 2007
New Revision: 40827

URL: http://llvm.org/viewvc/llvm-project?rev=40827&view=rev
Log:
Switch the internal "Info" map from an std::map to a DenseMap.  This
speeds up idom by about 45% and postidom by about 33%.

Some extra precautions must be taken not to invalidate densemap iterators.


Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=40827&r1=40826&r2=40827&view=diff

==
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Sat Aug  4 19:02:00 2007
@@ -127,7 +127,7 @@
   std::vector Vertex;
 
   // Info - Collection of information used during the computation of idoms.
-  std::map Info;
+  DenseMap Info;
 
   void updateDFSNumbers();
 
@@ -298,7 +298,7 @@
 private:
   void calculate(Function& F);
   DomTreeNode *getNodeForBlock(BasicBlock *BB);
-  unsigned DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N);
+  unsigned DFSPass(BasicBlock *V, unsigned N);
   void Compress(BasicBlock *V);
   BasicBlock *Eval(BasicBlock *v);
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);

Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=40827&r1=40826&r2=40827&view=diff

==
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sat Aug  4 19:02:00 2007
@@ -39,7 +39,7 @@
 private:
   void calculate(Function &F);
   DomTreeNode *getNodeForBlock(BasicBlock *BB);
-  unsigned DFSPass(BasicBlock *V, InfoRec &VInfo,unsigned N);
+  unsigned DFSPass(BasicBlock *V, unsigned N);
   void Compress(BasicBlock *V, InfoRec &VInfo);
   BasicBlock *Eval(BasicBlock *V);
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=40827&r1=40826&r2=40827&view=diff

==
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Sat Aug  4 19:02:00 2007
@@ -27,28 +27,25 @@
 static RegisterPass
 F("postdomtree", "Post-Dominator Tree Construction", true);
 
-unsigned PostDominatorTree::DFSPass(BasicBlock *V, InfoRec &VInfo,
-unsigned N) {
-  std::vector > workStack;
+unsigned PostDominatorTree::DFSPass(BasicBlock *V, unsigned N) {
+  std::vector workStack;
   std::set visited;
-  workStack.push_back(std::make_pair(V, &VInfo));
+  workStack.push_back(V);
 
   do {
-BasicBlock *currentBB = workStack.back().first; 
-InfoRec *currentVInfo = workStack.back().second;
+BasicBlock *currentBB = workStack.back();
+InfoRec &CurVInfo = Info[currentBB];
 
 // Visit each block only once.
-if (visited.count(currentBB) == 0) {
-
-  visited.insert(currentBB);
-  currentVInfo->Semi = ++N;
-  currentVInfo->Label = currentBB;
+if (visited.insert(currentBB).second) {
+  CurVInfo.Semi = ++N;
+  CurVInfo.Label = currentBB;
   
   Vertex.push_back(currentBB);  // Vertex[n] = current;
   // Info[currentBB].Ancestor = 0; 
   // Ancestor[n] = 0
   // Child[currentBB] = 0;
-  currentVInfo->Size = 1;   // Size[currentBB] = 1
+  CurVInfo.Size = 1;   // Size[currentBB] = 1
 }
 
 // Visit children
@@ -58,8 +55,8 @@
   InfoRec &SuccVInfo = Info[*PI];
   if (SuccVInfo.Semi == 0) {
 SuccVInfo.Parent = currentBB;
-if (visited.count (*PI) == 0) {
-  workStack.push_back(std::make_pair(*PI, &SuccVInfo));   
+if (!visited.count(*PI)) {
+  workStack.push_back(*PI);   
   visitChild = true;
 }
   }
@@ -130,7 +127,7 @@
   // in later stages of the algorithm.
   unsigned N = 0;
   for (unsigned i = 0, e = Roots.size(); i != e; ++i)
-N = DFSPass(Roots[i], Info[Roots[i]], N);
+N = DFSPass(Roots[i], N);
   
   for (unsigned i = N; i >= 2; --i) {
 BasicBlock *W = Vertex[i];

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=40827&r1=40826&r2=40827&view=diff

==
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sat Aug  4 19:02:00 2007
@@ -146,12 +146,12 @@
   }
 }
 
-unsigned DominatorTree::DFSPass(BasicBloc

[llvm-commits] [llvm] r40828 - /llvm/trunk/lib/VMCore/Dominators.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 19:10:08 2007
New Revision: 40828

URL: http://llvm.org/viewvc/llvm-project?rev=40828&view=rev
Log:
Switch DomTreeNode::assignDFSNumber from using a std::set to using
a smallptrset.  This speeds up domtree by about 15% and postdomtree by 20%.

Modified:
llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=40828&r1=40827&r2=40828&view=diff

==
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sat Aug  4 19:10:08 2007
@@ -496,10 +496,10 @@
 /// in dfs order.
 void DomTreeNode::assignDFSNumber(int num) {
   std::vector  workStack;
-  std::set visitedNodes;
+  SmallPtrSet Visited;
   
   workStack.push_back(this);
-  visitedNodes.insert(this);
+  Visited.insert(this);
   this->DFSNumIn = num++;
   
   while (!workStack.empty()) {
@@ -509,12 +509,12 @@
 for (std::vector::iterator DI = Node->begin(),
E = Node->end(); DI != E && !visitChild; ++DI) {
   DomTreeNode *Child = *DI;
-  if (visitedNodes.count(Child) == 0) {
-visitChild = true;
-Child->DFSNumIn = num++;
-workStack.push_back(Child);
-visitedNodes.insert(Child);
-  }
+  if (!Visited.insert(Child))
+continue;
+  
+  visitChild = true;
+  Child->DFSNumIn = num++;
+  workStack.push_back(Child);
 }
 if (!visitChild) {
   // If we reach here means all children are visited


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40829 - in /llvm/trunk/lib: Analysis/PostDominators.cpp VMCore/Dominators.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 19:15:57 2007
New Revision: 40829

URL: http://llvm.org/viewvc/llvm-project?rev=40829&view=rev
Log:
Switch some std::sets to SmallPtrSet.  This speeds up
domtree by 10% and postdomtree by 17%

Modified:
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=40829&r1=40828&r2=40829&view=diff

==
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Sat Aug  4 19:15:57 2007
@@ -29,7 +29,7 @@
 
 unsigned PostDominatorTree::DFSPass(BasicBlock *V, unsigned N) {
   std::vector workStack;
-  std::set visited;
+  SmallPtrSet Visited;
   workStack.push_back(V);
 
   do {
@@ -37,7 +37,7 @@
 InfoRec &CurVInfo = Info[currentBB];
 
 // Visit each block only once.
-if (visited.insert(currentBB).second) {
+if (Visited.insert(currentBB)) {
   CurVInfo.Semi = ++N;
   CurVInfo.Label = currentBB;
   
@@ -55,7 +55,7 @@
   InfoRec &SuccVInfo = Info[*PI];
   if (SuccVInfo.Semi == 0) {
 SuccVInfo.Parent = currentBB;
-if (!visited.count(*PI)) {
+if (!Visited.count(*PI)) {
   workStack.push_back(*PI);   
   visitChild = true;
 }

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=40829&r1=40828&r2=40829&view=diff

==
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sat Aug  4 19:15:57 2007
@@ -211,7 +211,7 @@
 void DominatorTree::Compress(BasicBlock *VIn) {
 
   std::vector Work;
-  std::set Visited;
+  SmallPtrSet Visited;
   BasicBlock *VInAncestor = Info[VIn].Ancestor;
   InfoRec &VInVAInfo = Info[VInAncestor];
 
@@ -225,9 +225,9 @@
 InfoRec &VAInfo = Info[VAncestor];
 
 // Process Ancestor first
-if (Visited.count(VAncestor) == 0 && VAInfo.Ancestor != 0) {
+if (Visited.insert(VAncestor) &&
+VAInfo.Ancestor != 0) {
   Work.push_back(VAncestor);
-  Visited.insert(VAncestor);
   continue;
 } 
 Work.pop_back(); 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r40830 - in /llvm/trunk/lib: Analysis/PostDominators.cpp VMCore/Dominators.cpp

2007-08-04 Thread Chris Lattner
Author: lattner
Date: Sat Aug  4 19:24:30 2007
New Revision: 40830

URL: http://llvm.org/viewvc/llvm-project?rev=40830&view=rev
Log:
Fix an iterator invalidation bug I induced.

Modified:
llvm/trunk/lib/Analysis/PostDominators.cpp
llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/lib/Analysis/PostDominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=40830&r1=40829&r2=40830&view=diff

==
--- llvm/trunk/lib/Analysis/PostDominators.cpp (original)
+++ llvm/trunk/lib/Analysis/PostDominators.cpp Sat Aug  4 19:24:30 2007
@@ -217,8 +217,7 @@
   // Add a new tree node for this BasicBlock, and link it as a child of
   // IDomNode
   DomTreeNode *C = new DomTreeNode(BB, IPDomNode);
-  DomTreeNodes[BB] = C;
-  return BBNode = IPDomNode->addChild(C);
+  return DomTreeNodes[BB] = IPDomNode->addChild(C);
 }
 
 
//===--===//

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=40830&r1=40829&r2=40830&view=diff

==
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Sat Aug  4 19:24:30 2007
@@ -120,7 +120,8 @@
   }
 
 
-  // Find NewBB's immediate dominator and create new dominator tree node for 
NewBB.
+  // Find NewBB's immediate dominator and create new dominator tree node for
+  // NewBB.
   BasicBlock *NewBBIDom = 0;
   unsigned i = 0;
   for (i = 0; i < PredBlocks.size(); ++i)
@@ -552,8 +553,7 @@
   // Add a new tree node for this BasicBlock, and link it as a child of
   // IDomNode
   DomTreeNode *C = new DomTreeNode(BB, IDomNode);
-  DomTreeNodes[BB] = C;
-  return BBNode = IDomNode->addChild(C);
+  return DomTreeNodes[BB] = IDomNode->addChild(C);
 }
 
 static std::ostream &operator<<(std::ostream &o,


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [test-suite] r40833 - in /test-suite/trunk/External/SPEC/CINT2006: 400.perlbench/ 401.bzip2/ 403.gcc/ 429.mcf/ 445.gobmk/ 456.hmmer/ 458.sjeng/ 462.libquantum/ 464.h264ref/ 471.omnetpp/

2007-08-04 Thread Reid Spencer
Author: reid
Date: Sun Aug  5 00:04:36 2007
New Revision: 40833

URL: http://llvm.org/viewvc/llvm-project?rev=40833&view=rev
Log:
Set the svn:ignore property to ignore built things.

Modified:
test-suite/trunk/External/SPEC/CINT2006/400.perlbench/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/401.bzip2/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/403.gcc/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/429.mcf/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/445.gobmk/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/456.hmmer/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/458.sjeng/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/462.libquantum/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/464.h264ref/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/471.omnetpp/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/473.astar/   (props changed)
test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/   (props changed)

Propchange: test-suite/trunk/External/SPEC/CINT2006/400.perlbench/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/401.bzip2/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/403.gcc/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/429.mcf/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/445.gobmk/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1,2 @@
+Output
+*.c

Propchange: test-suite/trunk/External/SPEC/CINT2006/456.hmmer/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/458.sjeng/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/462.libquantum/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/464.h264ref/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/471.omnetpp/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1,2 @@
+Output
+*.cc

Propchange: test-suite/trunk/External/SPEC/CINT2006/473.astar/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CINT2006/483.xalancbmk/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:04:36 2007
@@ -0,0 +1 @@
+Output


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [test-suite] r40834 - in /test-suite/trunk/External/SPEC: CFP2000/168.wupwise/ CFP2000/171.swim/ CFP2000/172.mgrid/ CFP2000/173.applu/ CFP2000/177.mesa/ CFP2000/178.galgel/ CFP2000/179.

2007-08-04 Thread Reid Spencer
Author: reid
Date: Sun Aug  5 00:05:44 2007
New Revision: 40834

URL: http://llvm.org/viewvc/llvm-project?rev=40834&view=rev
Log:
Set svn:ignore property to ignore built things.

Modified:
test-suite/trunk/External/SPEC/CFP2000/168.wupwise/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/171.swim/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/172.mgrid/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/173.applu/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/177.mesa/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/178.galgel/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/179.art/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/183.equake/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/187.facerec/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/188.ammp/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/189.lucas/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/191.fma3d/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/200.sixtrack/   (props changed)
test-suite/trunk/External/SPEC/CFP2000/301.apsi/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/410.bwaves/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/416.gamess/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/433.milc/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/434.zeusmp/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/435.gromacs/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/436.cactusADM/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/437.leslie3d/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/444.namd/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/447.dealII/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/450.soplex/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/453.povray/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/454.calculix/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/459.GemsFDTD/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/465.tonto/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/470.lbm/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/481.wrf/   (props changed)
test-suite/trunk/External/SPEC/CFP2006/482.sphinx3/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/164.gzip/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/175.vpr/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/176.gcc/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/181.mcf/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/186.crafty/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/197.parser/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/252.eon/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/253.perlbmk/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/254.gap/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/255.vortex/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/256.bzip2/   (props changed)
test-suite/trunk/External/SPEC/CINT2000/300.twolf/   (props changed)

Propchange: test-suite/trunk/External/SPEC/CFP2000/168.wupwise/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/171.swim/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/172.mgrid/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/173.applu/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/177.mesa/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/178.galgel/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/179.art/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 00:05:44 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/External/SPEC/CFP2000/183.equake/


[llvm-commits] [test-suite] r40835 - in /test-suite/trunk/MultiSource/Benchmarks: MiBench/automotive-basicmath/ MiBench/automotive-bitcount/ MiBench/automotive-susan/ MiBench/consumer-jpeg/ MiBench/co

2007-08-04 Thread Reid Spencer
Author: reid
Date: Sun Aug  5 01:00:56 2007
New Revision: 40835

URL: http://llvm.org/viewvc/llvm-project?rev=40835&view=rev
Log:
Ignore the Output directories.

Modified:
test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/   
(props changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/   
(props changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-susan/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-jpeg/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/data/hyph/ 
  (props changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/network-dijkstra/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/network-patricia/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/office-ispell/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/office-stringsearch/   
(props changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/security-blowfish/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/security-rijndael/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-CRC32/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-FFT/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-adpcm/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/MiBench/telecomm-gsm/   (props 
changed)
test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/   (props changed)

Propchange: 
test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-basicmath/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-bitcount/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/automotive-susan/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-jpeg/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-lame/

--
--- svn:ignore (original)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -7,3 +7,4 @@
 *.plg
 *.opt
 *.dll
+Output

Propchange: 
test-suite/trunk/MultiSource/Benchmarks/MiBench/consumer-typeset/data/hyph/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+*.lp

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/network-dijkstra/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/network-patricia/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/office-ispell/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/office-stringsearch/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-blowfish/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-rijndael/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiSource/Benchmarks/MiBench/security-sha/

--
--- svn:ignore (added)
+++ svn:ignore Sun Aug  5 01:00:56 2007
@@ -0,0 +1 @@
+Output

Propchange: test-suite/trunk/MultiS

[llvm-commits] [test-suite] r40836 - in /test-suite/trunk: Makefile.programs MultiSource/Applications/Burg/Makefile MultiSource/Applications/SIBsim4/ MultiSource/Applications/minisat/ MultiSource/Appl

2007-08-04 Thread Reid Spencer
Author: reid
Date: Sun Aug  5 01:10:33 2007
New Revision: 40836

URL: http://llvm.org/viewvc/llvm-project?rev=40836&view=rev
Log:
Stabilize test-suite:

1. Return to using -enable-correct-eh-support instead of -enable-eh until the
   enable-eh option proves itself. Several new test failures were tracked to
   this option.

2. Ensure that C++ programs are linked with g++ and not gcc as it does make a
   difference even though the input is assembly. The trick to doing this is
   to look for test directories that put -lstdc++ in LDFLAGS. These are 
   undoubtedly C++ programs, even if just partially.  

3. Correct the specification of -lstdc++ to be in LDFLAGS instead of LIBS in
   various Makefiles.

4. Make a couple new test directories ignore the Output directory to beautify
   the output of svn status.

Modified:
test-suite/trunk/Makefile.programs
test-suite/trunk/MultiSource/Applications/Burg/Makefile
test-suite/trunk/MultiSource/Applications/SIBsim4/   (props changed)
test-suite/trunk/MultiSource/Applications/minisat/   (props changed)
test-suite/trunk/MultiSource/Applications/minisat/Makefile
test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/Makefile
test-suite/trunk/SingleSource/Regression/C++/EH/Makefile
test-suite/trunk/SingleSource/Regression/C++/Makefile
test-suite/trunk/SingleSource/UnitTests/SetjmpLongjmp/C++/Makefile
test-suite/trunk/SingleSource/UnitTests/SignlessTypes/Makefile
test-suite/trunk/SingleSource/UnitTests/Threads/   (props changed)

Modified: test-suite/trunk/Makefile.programs
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=40836&r1=40835&r2=40836&view=diff

==
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Sun Aug  5 01:10:33 2007
@@ -43,8 +43,7 @@
 include $(LEVEL)/Makefile.tests
 
 .PRECIOUS: Output/%.llvm Output/%.native Output/%.llc Output/%.llc.s
-.PRECIOUS: Output/%.cbe Output/%.cbe.c Output/%.llvm.bc
-.PRECIOUS: Output/%.linked.bc
+.PRECIOUS: Output/%.cbe Output/%.cbe.c Output/%.llvm.bc Output/%.linked.bc
 
 # If we're using the llvm-gcc3 compiler then we need to also link with the
 # llvm c runtime library, othwerwise we don't
@@ -304,7 +303,7 @@
 # If the program requires exception handling support, enable (potentially
 # expensive) support for it.
 ifdef REQUIRES_EH_SUPPORT
-LLCFLAGS += -enable-eh
+LLCFLAGS += -enable-correct-eh-support
 LLVMLD_FLAGS += -disable-inlining
 endif
 
@@ -313,6 +312,14 @@
 LLCFLAGS += $(TARGET_LLCFLAGS)
 endif
 
+# It is important to link C++ programs with G++ so look for -lstdc++ in LDFLAGS
+# and set the LLVMGCCLD variable to the correct compiler interface to use.
+ifneq ($(filter -lstdc++,$(LDFLAGS)),)
+LLVMGCCLD := $(CXX) 
+else
+LLVMGCCLD := $(CC)
+endif
+
 #
 # Rules to compile the program for the C Back End
 #
@@ -320,14 +327,9 @@
 Output/%.cbe.c: Output/%.llvm.bc $(LLC)
-$(LLC) $(LLCFLAGS) -march=c $< -o $@ -f
 
-ifdef REQUIRES_EH_SUPPORT
-MORE_LDFLAGS=-L$(LLVMGCCDIR)/lib/gcc/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib 
-lstdc++
-endif
-
 $(PROGRAMS_TO_TEST:%=Output/%.cbe): \
 Output/%.cbe: Output/%.cbe.c
-   -$(CC) $< -o $@ $(LDFLAGS) $(MORE_LDFLAGS) $(CFLAGS) \
- -fno-strict-aliasing -O2 -fno-inline $(TARGET_FLAGS)
+   -$(CC) $< -o $@ $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O2 
-fno-inline $(TARGET_FLAGS) $(LIBS)
 
 #
 # Compile a linked program to machine code with LLC.
@@ -353,13 +355,11 @@
 #
 $(PROGRAMS_TO_TEST:%=Output/%.llc): \
 Output/%.llc: Output/%.llc.s
-   -$(CC) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
- $(TARGET_FLAGS) $(LDFLAGS) $(MORE_LDFLAGS)
+   -$(LLVMGCCLD) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) 
$(TARGET_FLAGS) $(LDFLAGS)
 
 $(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
 Output/%.llc-beta: Output/%.llc-beta.s
-   -$(CC) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
- $(TARGET_FLAGS) $(LDFLAGS) $(MORE_LDFLAGS)
+   -$(LLVMGCCLD) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) 
$(TARGET_FLAGS) $(LDFLAGS)
 
 
 #
@@ -377,7 +377,7 @@
 # If the program requires exception handling support, enable (potentially
 # expensive) support for it.
 ifdef REQUIRES_EH_SUPPORT
-JIT_OPTS += -enable-eh
+JIT_OPTS += -enable-correct-eh-support
 endif
 
 native: $(PROGRAMS_TO_TEST:%=Output/%.native)

Modified: test-suite/trunk/MultiSource/Applications/Burg/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Applications/Burg/Makefile?rev=40836&r1=40835&r2=40836&view=diff

==
--- test-suite/trunk/MultiSource/Applications/Burg/Makefile (original)
+++ test-suite/trunk/MultiSource/Applications/Burg/Makefile Sun Aug  5 01:10:33 
2007
@@ -4,7 +4,7 @@
 
 PROG = burg
 CPPFLAGS = -DDEBUG
-LDFLAGS  = 
+LDFLAGS  = -lstdc++
 
 ExtraSource := y.tab.c
 

Propchange: test