[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp

2007-04-07 Thread Owen Anderson


Changes in directory llvm/lib/VMCore:

Dominators.cpp updated: 1.85 -> 1.86
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+14 -109)

 Dominators.cpp |  123 ++---
 1 files changed, 14 insertions(+), 109 deletions(-)


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.85 llvm/lib/VMCore/Dominators.cpp:1.86
--- llvm/lib/VMCore/Dominators.cpp:1.85 Wed Mar 28 09:57:43 2007
+++ llvm/lib/VMCore/Dominators.cpp  Sat Apr  7 02:17:27 2007
@@ -251,113 +251,6 @@
   o << "\n";
 }
 
-
-
-//===--===//
-//  DominatorSet Implementation
-//===--===//
-
-static RegisterPass
-B("domset", "Dominator Set Construction", true);
-
-// dominates - Return true if A dominates B.  This performs the special checks
-// necessary if A and B are in the same basic block.
-//
-bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
-  BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
-  if (BBA != BBB) return dominates(BBA, BBB);
-
-  // It is not possible to determine dominance between two PHI nodes 
-  // based on their ordering.
-  if (isa(A) && isa(B)) 
-return false;
-
-  // Loop through the basic block until we find A or B.
-  BasicBlock::iterator I = BBA->begin();
-  for (; &*I != A && &*I != B; ++I) /*empty*/;
-
-  if(!IsPostDominators) {
-// A dominates B if it is found first in the basic block.
-return &*I == A;
-  } else {
-// A post-dominates B if B is found first in the basic block.
-return &*I == B;
-  }
-}
-
-
-// runOnFunction - This method calculates the forward dominator sets for the
-// specified function.
-//
-bool DominatorSet::runOnFunction(Function &F) {
-  BasicBlock *Root = &F.getEntryBlock();
-  Roots.clear();
-  Roots.push_back(Root);
-  assert(pred_begin(Root) == pred_end(Root) &&
- "Root node has predecessors in function!");
-
-  ImmediateDominators &ID = getAnalysis();
-  Doms.clear();
-  if (Roots.empty()) return false;
-
-  // Root nodes only dominate themselves.
-  for (unsigned i = 0, e = Roots.size(); i != e; ++i)
-Doms[Roots[i]].insert(Roots[i]);
-
-  // Loop over all of the blocks in the function, calculating dominator sets 
for
-  // each function.
-  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
-if (BasicBlock *IDom = ID[I]) {   // Get idom if block is reachable
-  DomSetType &DS = Doms[I];
-  assert(DS.empty() && "Domset already filled in for this block?");
-  DS.insert(I);  // Blocks always dominate themselves
-
-  // Insert all dominators into the set...
-  while (IDom) {
-// If we have already computed the dominator sets for our immediate
-// dominator, just use it instead of walking all the way up to the 
root.
-DomSetType &IDS = Doms[IDom];
-if (!IDS.empty()) {
-  DS.insert(IDS.begin(), IDS.end());
-  break;
-} else {
-  DS.insert(IDom);
-  IDom = ID[IDom];
-}
-  }
-} else {
-  // Ensure that every basic block has at least an empty set of nodes.  
This
-  // is important for the case when there is unreachable blocks.
-  Doms[I];
-}
-
-  return false;
-}
-
-namespace llvm {
-static std::ostream &operator<<(std::ostream &o,
-const std::set &BBs) {
-  for (std::set::const_iterator I = BBs.begin(), E = BBs.end();
-   I != E; ++I)
-if (*I)
-  WriteAsOperand(o, *I, false);
-else
-  o << " <>";
-  return o;
-}
-}
-
-void DominatorSetBase::print(std::ostream &o, const Module* ) const {
-  for (const_iterator I = begin(), E = end(); I != E; ++I) {
-o << "  DomSet For BB: ";
-if (I->first)
-  WriteAsOperand(o, I->first, false);
-else
-  o << " <>";
-o << " is:\t" << I->second << "\n";
-  }
-}
-
 
//===--===//
 //  DominatorTree Implementation
 
//===--===//
@@ -528,6 +421,20 @@
   return *Result;
 }
 
+namespace llvm {
+static std::ostream &operator<<(std::ostream &o,
+const std::set &BBs) {
+  for (std::set::const_iterator I = BBs.begin(), E = BBs.end();
+   I != E; ++I)
+if (*I)
+  WriteAsOperand(o, *I, false);
+else
+  o << " <>";
+  return o;
+}
+}
+
+
 void DominanceFrontierBase::print(std::ostream &o, const Module* ) const {
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
 o << "  DomFrontier for BB";
@@ -1071,5 +978,3 @@
   }
   o << "\n";
 }
-
-DEFINING_FILE_FOR(DominatorSet)



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

[llvm-commits] CVS: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h FunctionUtils.h

2007-04-07 Thread Owen Anderson


Changes in directory llvm/include/llvm/Transforms/Utils:

BasicBlockUtils.h updated: 1.15 -> 1.16
FunctionUtils.h updated: 1.10 -> 1.11
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+1 -2)

 BasicBlockUtils.h |2 +-
 FunctionUtils.h   |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
diff -u llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.15 
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.16
--- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.15   Sat Oct 28 
01:58:17 2006
+++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.hSat Apr  7 
02:17:27 2007
@@ -61,7 +61,7 @@
 bool AllowIdenticalEdges = false);
 
 /// SplitCriticalEdge - If this edge is a critical edge, insert a new node to
-/// split the critical edge.  This will update DominatorSet, 
ImmediateDominator,
+/// split the critical edge.  This will update ETForest, ImmediateDominator,
 /// DominatorTree, and DominatorFrontier information if it is available, thus
 /// calling this pass will not invalidate either of them.  This returns true if
 /// the edge was split, false otherwise.  If MergeIdenticalEdges is true (the


Index: llvm/include/llvm/Transforms/Utils/FunctionUtils.h
diff -u llvm/include/llvm/Transforms/Utils/FunctionUtils.h:1.10 
llvm/include/llvm/Transforms/Utils/FunctionUtils.h:1.11
--- llvm/include/llvm/Transforms/Utils/FunctionUtils.h:1.10 Sat Apr  7 
00:31:27 2007
+++ llvm/include/llvm/Transforms/Utils/FunctionUtils.h  Sat Apr  7 02:17:27 2007
@@ -19,7 +19,6 @@
 
 namespace llvm {
   class BasicBlock;
-  class DominatorSet;
   class Function;
   class Loop;
 



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


[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h PostDominators.h

2007-04-07 Thread Owen Anderson


Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.64 -> 1.65
PostDominators.h updated: 1.14 -> 1.15
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+1 -149)

 Dominators.h |  127 ---
 PostDominators.h |   23 -
 2 files changed, 1 insertion(+), 149 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.64 
llvm/include/llvm/Analysis/Dominators.h:1.65
--- llvm/include/llvm/Analysis/Dominators.h:1.64Tue Mar 20 15:19:48 2007
+++ llvm/include/llvm/Analysis/Dominators.h Sat Apr  7 02:17:27 2007
@@ -10,8 +10,7 @@
 // This file defines the following classes:
 //  1. ImmediateDominators: Calculates and holds a mapping between BasicBlocks
 // and their immediate dominator.
-//  2. DominatorSet: Calculates the [reverse] dominator set for a function
-//  3. DominatorTree: Represent the ImmediateDominator as an explicit tree
+//  2. DominatorTree: Represent the ImmediateDominator as an explicit tree
 // structure.
 //  4. ETForest: Efficient data structure for dominance comparisons and 
 // nearest-common-ancestor queries.
@@ -175,127 +174,6 @@
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
 };
 
-
-
-//===--===//
-/// DominatorSet - Maintain a set for every basic block in a
-/// function, that represents the blocks that dominate the block.  If the block
-/// is unreachable in this function, the set will be empty.  This cannot happen
-/// for reachable code, because every block dominates at least itself.
-///
-class DominatorSetBase : public DominatorBase {
-public:
-  typedef std::set DomSetType;// Dom set for a bb
-  // Map of dom sets
-  typedef std::map DomSetMapType;
-protected:
-  DomSetMapType Doms;
-public:
-  DominatorSetBase(bool isPostDom) : DominatorBase(isPostDom) {}
-
-  virtual void releaseMemory() { Doms.clear(); }
-
-  // Accessor interface:
-  typedef DomSetMapType::const_iterator const_iterator;
-  typedef DomSetMapType::iterator iterator;
-  inline const_iterator begin() const { return Doms.begin(); }
-  inline   iterator begin()   { return Doms.begin(); }
-  inline const_iterator end()   const { return Doms.end(); }
-  inline   iterator end() { return Doms.end(); }
-  inline const_iterator find(BasicBlock* B) const { return Doms.find(B); }
-  inline   iterator find(BasicBlock* B)   { return Doms.find(B); }
-
-
-  /// getDominators - Return the set of basic blocks that dominate the 
specified
-  /// block.
-  ///
-  inline const DomSetType &getDominators(BasicBlock *BB) const {
-const_iterator I = find(BB);
-assert(I != end() && "BB not in function!");
-return I->second;
-  }
-
-  /// isReachable - Return true if the specified basicblock is reachable.  If
-  /// the block is reachable, we have dominator set information for it.
-  ///
-  bool isReachable(BasicBlock *BB) const {
-return !getDominators(BB).empty();
-  }
-
-  /// dominates - Return true if A dominates B.
-  ///
-  inline bool dominates(BasicBlock *A, BasicBlock *B) const {
-return getDominators(B).count(A) != 0;
-  }
-
-  /// properlyDominates - Return true if A dominates B and A != B.
-  ///
-  bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
-return dominates(A, B) && A != B;
-  }
-
-  /// print - Convert to human readable form
-  ///
-  virtual void print(std::ostream &OS, const Module* = 0) const;
-  void print(std::ostream *OS, const Module* M = 0) const {
-if (OS) print(*OS, M);
-  }
-
-  /// dominates - Return true if A dominates B.  This performs the special
-  /// checks necessary if A and B are in the same basic block.
-  ///
-  bool dominates(Instruction *A, Instruction *B) const;
-
-  
//======//
-  // API to update (Post)DominatorSet information based on modifications to
-  // the CFG...
-
-  /// addBasicBlock - Call to update the dominator set with information about a
-  /// new block that was inserted into the function.
-  ///
-  void addBasicBlock(BasicBlock *BB, const DomSetType &Dominators) {
-assert(find(BB) == end() && "Block already in DominatorSet!");
-Doms.insert(std::make_pair(BB, Dominators));
-  }
-
-  /// addDominator - If a new block is inserted into the CFG, then method may 
be
-  /// called to notify the blocks it dominates that it is in their set.
-  ///
-  void addDominator(BasicBlock *BB, BasicBlock *NewDominator) {
-iterator I = find(BB);
-assert(I != end() && "BB is not in DominatorSet!");
-I->second.insert(NewDominator);
-  }
-};
-
-
-//===-
-/// DominatorSet Class - Concrete subclass of DominatorSetBase that is used to
-/// compute a normal dominator set.
-///
-c

[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

2007-04-07 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Scalar:

LoopStrengthReduce.cpp updated: 1.126 -> 1.127
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+0 -1)

 LoopStrengthReduce.cpp |1 -
 1 files changed, 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.126 
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.127
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.126 Tue Apr  3 
00:11:24 2007
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp   Sat Apr  7 02:17:27 2007
@@ -154,7 +154,6 @@
   // many analyses if they are around.
   AU.addPreservedID(LoopSimplifyID);
   AU.addPreserved();
-  AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();



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


[llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp

2007-04-07 Thread Owen Anderson


Changes in directory llvm/lib/Analysis:

PostDominators.cpp updated: 1.62 -> 1.63
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+0 -67)

 PostDominators.cpp |   67 -
 1 files changed, 67 deletions(-)


Index: llvm/lib/Analysis/PostDominators.cpp
diff -u llvm/lib/Analysis/PostDominators.cpp:1.62 
llvm/lib/Analysis/PostDominators.cpp:1.63
--- llvm/lib/Analysis/PostDominators.cpp:1.62   Fri Nov 17 01:10:51 2006
+++ llvm/lib/Analysis/PostDominators.cppSat Apr  7 02:17:27 2007
@@ -167,73 +167,6 @@
 }
 
 
//===--===//
-//  PostDominatorSet Implementation
-//===--===//
-
-static RegisterPass
-B("postdomset", "Post-Dominator Set Construction", true);
-
-// Postdominator set construction.  This converts the specified function to 
only
-// have a single exit node (return stmt), then calculates the post dominance
-// sets for the function.
-//
-bool PostDominatorSet::runOnFunction(Function &F) {
-  // Scan the function looking for the root nodes of the post-dominance
-  // relationships.  These blocks end with return and unwind instructions.
-  // While we are iterating over the function, we also initialize all of the
-  // domsets to empty.
-  Roots.clear();
-  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
-if (succ_begin(I) == succ_end(I))
-  Roots.push_back(I);
-
-  // If there are no exit nodes for the function, postdomsets are all empty.
-  // This can happen if the function just contains an infinite loop, for
-  // example.
-  ImmediatePostDominators &IPD = getAnalysis();
-  Doms.clear();   // Reset from the last time we were run...
-  if (Roots.empty()) return false;
-
-  // If we have more than one root, we insert an artificial "null" exit, which
-  // has "virtual edges" to each of the real exit nodes.
-  //if (Roots.size() > 1)
-  //  Doms[0].insert(0);
-
-  // Root nodes only dominate themselves.
-  for (unsigned i = 0, e = Roots.size(); i != e; ++i)
-Doms[Roots[i]].insert(Roots[i]);
-  
-  // Loop over all of the blocks in the function, calculating dominator sets 
for
-  // each function.
-  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
-if (BasicBlock *IPDom = IPD[I]) {   // Get idom if block is reachable
-  DomSetType &DS = Doms[I];
-  assert(DS.empty() && "PostDomset already filled in for this block?");
-  DS.insert(I);  // Blocks always dominate themselves
-
-  // Insert all dominators into the set...
-  while (IPDom) {
-// If we have already computed the dominator sets for our immediate 
post
-// dominator, just use it instead of walking all the way up to the 
root.
-DomSetType &IPDS = Doms[IPDom];
-if (!IPDS.empty()) {
-  DS.insert(IPDS.begin(), IPDS.end());
-  break;
-} else {
-  DS.insert(IPDom);
-  IPDom = IPD[IPDom];
-}
-  }
-} else {
-  // Ensure that every basic block has at least an empty set of nodes.  
This
-  // is important for the case when there is unreachable blocks.
-  Doms[I];
-}
-
-  return false;
-}
-
-//===--===//
 //  PostDominatorTree Implementation
 
//===--===//
 



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


[llvm-commits] CVS: llvm/include/llvm/LinkAllPasses.h

2007-04-07 Thread Owen Anderson


Changes in directory llvm/include/llvm:

LinkAllPasses.h updated: 1.12 -> 1.13
---
Log message:

Completely purge DomSet.  This is the (hopefully) final patch for PR1171: 
http://llvm.org/PR1171 .


---
Diffs of the changes:  (+0 -1)

 LinkAllPasses.h |1 -
 1 files changed, 1 deletion(-)


Index: llvm/include/llvm/LinkAllPasses.h
diff -u llvm/include/llvm/LinkAllPasses.h:1.12 
llvm/include/llvm/LinkAllPasses.h:1.13
--- llvm/include/llvm/LinkAllPasses.h:1.12  Fri Apr  6 23:43:02 2007
+++ llvm/include/llvm/LinkAllPasses.h   Sat Apr  7 02:17:26 2007
@@ -114,7 +114,6 @@
 
   (void)new llvm::IntervalPartition();
   (void)new llvm::ImmediateDominators();
-  (void)new llvm::PostDominatorSet();
   (void)new llvm::FindUsedTypes();
   (void)new llvm::ScalarEvolution();
   ((llvm::Function*)0)->viewCFGOnly();



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


[llvm-commits] CVS: llvm/win32/Transforms/Transforms.vcproj

2007-04-07 Thread Jeff Cohen


Changes in directory llvm/win32/Transforms:

Transforms.vcproj updated: 1.26 -> 1.27
---
Log message:

Unbreak VC++ build.

---
Diffs of the changes:  (+3 -0)

 Transforms.vcproj |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/win32/Transforms/Transforms.vcproj
diff -u llvm/win32/Transforms/Transforms.vcproj:1.26 
llvm/win32/Transforms/Transforms.vcproj:1.27
--- llvm/win32/Transforms/Transforms.vcproj:1.26Sun Apr  1 13:58:22 2007
+++ llvm/win32/Transforms/Transforms.vcproj Sat Apr  7 09:31:16 2007
@@ -234,6 +234,9 @@

RelativePath="..\..\lib\Transforms\Scalar\LICM.cpp">


+   
+   

http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/Users.html

2007-04-07 Thread Reid Spencer


Changes in directory llvm-www:

Users.html updated: 1.13 -> 1.14
---
Log message:

Add missing "


---
Diffs of the changes:  (+2 -2)

 Users.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-www/Users.html
diff -u llvm-www/Users.html:1.13 llvm-www/Users.html:1.14
--- llvm-www/Users.html:1.13Fri Apr  6 22:29:00 2007
+++ llvm-www/Users.html Sat Apr  7 10:04:37 2007
@@ -92,7 +92,7 @@
 http://faramir.ugent.be/";>GH-SEL, INTEC, Ghent 
University
 http://users.ugent.be/~badams/";>Bram Adams
 Aspect weaver for an AOP-language for C called 
-  http://users.ugent.be/~badams/aspicere2/";>Aspicere2
+  http://users.ugent.be/~badams/aspicere2/";>Aspicere2
   
 
   
@@ -238,6 +238,6 @@
   src="http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
 
 mailto:[EMAIL PROTECTED]">LLVM Development List
-  Last modified: $Date: 2007/04/07 03:29:00 $
+  Last modified: $Date: 2007/04/07 15:04:37 $
 
 



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


[llvm-commits] CVS: llvm/include/llvm/Support/ConstantRange.h

2007-04-07 Thread Nick Lewycky


Changes in directory llvm/include/llvm/Support:

ConstantRange.h updated: 1.21 -> 1.22
---
Log message:

Add signExtend to ConstantRange, to complement zeroExtend and truncate.


---
Diffs of the changes:  (+6 -0)

 ConstantRange.h |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/include/llvm/Support/ConstantRange.h
diff -u llvm/include/llvm/Support/ConstantRange.h:1.21 
llvm/include/llvm/Support/ConstantRange.h:1.22
--- llvm/include/llvm/Support/ConstantRange.h:1.21  Sat Mar 10 09:54:12 2007
+++ llvm/include/llvm/Support/ConstantRange.h   Sat Apr  7 10:41:33 2007
@@ -157,6 +157,12 @@
   /// zero extended to BitWidth.
   ConstantRange zeroExtend(uint32_t BitWidth) const;
 
+  /// signExtend - Return a new range in the specified integer type, which must
+  /// be strictly larger than the current type.  The returned range will
+  /// correspond to the possible range of values if the source range had been
+  /// sign extended to BitWidth.
+  ConstantRange signExtend(uint32_t BitWidth) const;
+
   /// truncate - Return a new range in the specified integer type, which must 
be
   /// strictly smaller than the current type.  The returned range will
   /// correspond to the possible range of values if the source range had been



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


[llvm-commits] CVS: llvm/lib/Support/ConstantRange.cpp

2007-04-07 Thread Nick Lewycky


Changes in directory llvm/lib/Support:

ConstantRange.cpp updated: 1.42 -> 1.43
---
Log message:

Add signExtend to ConstantRange, to complement zeroExtend and truncate.


---
Diffs of the changes:  (+17 -0)

 ConstantRange.cpp |   17 +
 1 files changed, 17 insertions(+)


Index: llvm/lib/Support/ConstantRange.cpp
diff -u llvm/lib/Support/ConstantRange.cpp:1.42 
llvm/lib/Support/ConstantRange.cpp:1.43
--- llvm/lib/Support/ConstantRange.cpp:1.42 Sat Mar 31 22:47:44 2007
+++ llvm/lib/Support/ConstantRange.cpp  Sat Apr  7 10:41:33 2007
@@ -346,6 +346,23 @@
   return ConstantRange(L, U);
 }
 
+/// signExtend - Return a new range in the specified integer type, which must
+/// be strictly larger than the current type.  The returned range will
+/// correspond to the possible range of values as if the source range had been
+/// sign extended.
+ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
+  unsigned SrcTySize = getBitWidth();
+  assert(SrcTySize < DstTySize && "Not a value extension");
+  if (isFullSet()) {
+return 
ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1),
+ APInt::getLowBitsSet(DstTySize, SrcTySize-1));
+  }
+
+  APInt L = Lower; L.sext(DstTySize);
+  APInt U = Upper; U.sext(DstTySize);
+  return ConstantRange(L, U);
+}
+
 /// truncate - Return a new range in the specified integer type, which must be
 /// strictly smaller than the current type.  The returned range will
 /// correspond to the possible range of values as if the source range had been



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


[llvm-commits] llvm-gcc build broken

2007-04-07 Thread Jeff Cohen
Something broke it in the last 24 hours.

/usr/home/jeffc/llvm-gcc/obj/gcc/xgcc 
-B/usr/home/jeffc/llvm-gcc/obj/gcc/ 
-B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/bin/ 
-B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/lib/ -isystem 
/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/include -isystem 
/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/sys-include -O2  
-DIN_GCC-W -Wall -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC 
-g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../gcc 
-I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include  
-I/usr/home/jeffc/llvm/include -I/home/jeffc/llvm/obj/include -DL_ctzdi2 
-c ../../gcc/libgcc2.c -o libgcc/./_ctzdi2.o
WARNING: 128-bit integers not supported!
../../gcc/libgcc2.c:746: internal compiler error: Segmentation fault: 11
Please submit a full bug report,


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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp

2007-04-07 Thread Nick Lewycky


Changes in directory llvm/lib/Transforms/Scalar:

PredicateSimplifier.cpp updated: 1.65 -> 1.66
---
Log message:

Add support for cast instructions.


---
Diffs of the changes:  (+75 -17)

 PredicateSimplifier.cpp |   92 +++-
 1 files changed, 75 insertions(+), 17 deletions(-)


Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.65 
llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.66
--- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.65 Fri Apr  6 
23:49:12 2007
+++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp  Sat Apr  7 10:48:32 2007
@@ -813,6 +813,14 @@
   return Range;
 }
 
+#ifndef NDEBUG
+bool isCanonical(Value *V, ETNode *Subtree, VRPSolver *VRP);
+#endif
+
+  public:
+
+explicit ValueRanges(TargetData *TD) : TD(TD) {}
+
 // rangeFromValue - converts a Value into a range. If the value is a
 // constant it constructs the single element range, otherwise it performs
 // a lookup. The width W must be retrieved from typeToWidth and may not
@@ -842,14 +850,6 @@
   return 0;
 }
 
-#ifndef NDEBUG
-bool isCanonical(Value *V, ETNode *Subtree, VRPSolver *VRP);
-#endif
-
-  public:
-
-explicit ValueRanges(TargetData *TD) : TD(TD) {}
-
 bool isRelatedBy(Value *V1, Value *V2, ETNode *Subtree, LatticeVal LV) {
   uint32_t W = typeToWidth(V1->getType());
   if (!W) return false;
@@ -907,6 +907,7 @@
 
 void addToWorklist(Value *V, Constant *C, ICmpInst::Predicate Pred,
VRPSolver *VRP);
+void markBlock(VRPSolver *VRP);
 
 void mergeInto(Value **I, unsigned n, Value *New, ETNode *Subtree,
VRPSolver *VRP) {
@@ -946,7 +947,14 @@
 }
   }
 
-  update(V, CR, Subtree);
+  ConstantRange Merged = CR.intersectWith(
+rangeFromValue(V, Subtree, CR.getBitWidth()));
+  if (Merged.isEmptySet()) {
+markBlock(VRP);
+return;
+  }
+
+  update(V, Merged, Subtree);
 }
 
 void addNotEquals(Value *V1, Value *V2, ETNode *Subtree, VRPSolver *VRP) {
@@ -1608,8 +1616,29 @@
   add(Ptr, Constant::getNullValue(Ptr->getType()), ICmpInst::ICMP_NE,
   NewContext);
 }
+  } else if (CastInst *CI = dyn_cast(I)) {
+const Type *SrcTy = CI->getSrcTy();
+
+Value *TheCI = IG.canonicalize(CI, Top);
+uint32_t W = VR.typeToWidth(SrcTy);
+if (!W) return;
+ConstantRange CR = VR.rangeFromValue(TheCI, Top, W);
+
+if (CR.isFullSet()) return;
+
+switch (CI->getOpcode()) {
+  default: break;
+  case Instruction::ZExt:
+  case Instruction::SExt:
+VR.applyRange(IG.canonicalize(CI->getOperand(0), Top),
+  CR.truncate(W), Top, this);
+break;
+  case Instruction::BitCast:
+VR.applyRange(IG.canonicalize(CI->getOperand(0), Top),
+  CR, Top, this);
+break;
+}
   }
-  // TODO: CastInst "%a = cast ... %b" where %a is EQ or NE a constant.
 }
 
 /// opsToDef - A new relationship was discovered involving one of this
@@ -1639,7 +1668,7 @@
 assert(!Ty->isFPOrFPVector() && "Float in work queue!");
 
 Constant *Zero = Constant::getNullValue(Ty);
-Constant *AllOnes = ConstantInt::getAllOnesValue(Ty);
+ConstantInt *AllOnes = ConstantInt::getAllOnesValue(Ty);
 
 switch (Opcode) {
   default: break;
@@ -1753,16 +1782,41 @@
   add(SI, SI->getTrueValue(), ICmpInst::ICMP_EQ, NewContext);
 }
   } else if (CastInst *CI = dyn_cast(I)) {
-const Type *Ty = CI->getDestTy();
-if (Ty->isFPOrFPVector()) return;
+const Type *DestTy = CI->getDestTy();
+if (DestTy->isFPOrFPVector()) return;
 
-if (Constant *C = dyn_cast(
-IG.canonicalize(CI->getOperand(0), Top))) {
-  add(CI, ConstantExpr::getCast(CI->getOpcode(), C, Ty),
+Value *Op = IG.canonicalize(CI->getOperand(0), Top);
+Instruction::CastOps Opcode = CI->getOpcode();
+
+if (Constant *C = dyn_cast(Op)) {
+  add(CI, ConstantExpr::getCast(Opcode, C, DestTy),
   ICmpInst::ICMP_EQ, NewContext);
 }
 
-// TODO: "%a = cast ... %b" where %b is NE/LT/GT a constant.
+uint32_t W = VR.typeToWidth(DestTy);
+Value *TheCI = IG.canonicalize(CI, Top);
+ConstantRange CR = VR.rangeFromValue(Op, Top, W);
+
+if (!CR.isFullSet()) {
+  switch (Opcode) {
+default: break;
+case Instruction::ZExt:
+  VR.applyRange(TheCI, CR.zeroExtend(W), Top, this);
+  break;
+case Instruction::SExt:
+  VR.applyRange(TheCI, CR.signExtend(W), Top, this);
+  break;
+case Instruction::Trunc: {
+ 

[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-04-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.77 -> 1.78
---
Log message:

For PR1312: http://llvm.org/PR1312 :
For the short CALL/INVOKE syntax, the signedness of the result type is two
extractions away from the type argument because its a POINTER to function
type, not a function type.


---
Diffs of the changes:  (+8 -2)

 UpgradeParser.y |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.77 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.78
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.77Sun Apr  1 21:08:05 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Sat Apr  7 11:10:37 2007
@@ -3291,7 +3291,10 @@
   $$.S.copy($3.S);
 } else {
   FTySign = $3.S;
-  $$.S.copy($3.S.get(0)); // 0th element of FuncTy sign is result ty
+  // Get the signedness of the result type. $3 is the pointer to the
+  // function type so we get the 0th element to extract the function type,
+  // and then the 0th element again to get the result type.
+  $$.S.copy($3.S.get(0).get(0)); 
 }
 $4.S.makeComposite(FTySign);
 Value *V = getVal(PFTy, $4);   // Get the function we're calling...
@@ -3688,7 +3691,10 @@
   $$.S.copy($3.S);
 } else {
   FTySign = $3.S;
-  $$.S.copy($3.S.get(0)); // 0th element of FuncTy signedness is result 
sign
+  // Get the signedness of the result type. $3 is the pointer to the
+  // function type so we get the 0th element to extract the function type,
+  // and then the 0th element again to get the result type.
+  $$.S.copy($3.S.get(0).get(0)); 
 }
 $4.S.makeComposite(FTySign);
 



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs UpgradeParser.y.cvs

2007-04-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.cpp.cvs updated: 1.71 -> 1.72
UpgradeParser.y.cvs updated: 1.70 -> 1.71
---
Log message:

Regenerate.


---
Diffs of the changes:  (+66 -54)

 UpgradeParser.cpp.cvs |  110 ++
 UpgradeParser.y.cvs   |   10 +++-
 2 files changed, 66 insertions(+), 54 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.71 
llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.72
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs:1.71  Sun Apr  1 21:08:35 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp.cvs   Sat Apr  7 11:14:01 2007
@@ -2548,12 +2548,12 @@
 3062,  3063,  3067,  3068,  3067,  3080,  3081,  3086,  3087,  3088,
 3089,  3093,  3097,  3098,  3099,  3100,  3121,  3125,  3139,  3140,
 3145,  3145,  3153,  3163,  3166,  3175,  3186,  3191,  3200,  3211,
-3211,  3214,  3218,  3222,  3227,  3237,  3255,  3264,  3329,  ,
-3340,  3352,  3367,  3397,  3407,  3417,  3421,  3428,  3429,  3433,
-3436,  3442,  3461,  3479,  3495,  3509,  3523,  3534,  3552,  3561,
-3570,  3577,  3598,  3622,  3628,  3634,  3640,  3656,  3740,  3748,
-3749,  3753,  3754,  3758,  3764,  3771,  3777,  3784,  3791,  3804,
-3830
+3211,  3214,  3218,  3222,  3227,  3237,  3255,  3264,  3332,  3336,
+3343,  3355,  3370,  3400,  3410,  3420,  3424,  3431,  3432,  3436,
+3439,  3445,  3464,  3482,  3498,  3512,  3526,  3537,  3555,  3564,
+3573,  3580,  3601,  3625,  3631,  3637,  3643,  3659,  3746,  3754,
+3755,  3759,  3760,  3764,  3770,  3777,  3783,  3790,  3797,  3810,
+3836
 };
 #endif
 
@@ -5865,7 +5865,10 @@
   (yyval.TermInstVal).S.copy((yyvsp[-10].TypeVal).S);
 } else {
   FTySign = (yyvsp[-10].TypeVal).S;
-  (yyval.TermInstVal).S.copy((yyvsp[-10].TypeVal).S.get(0)); // 0th 
element of FuncTy sign is result ty
+  // Get the signedness of the result type. $3 is the pointer to the
+  // function type so we get the 0th element to extract the function type,
+  // and then the 0th element again to get the result type.
+  (yyval.TermInstVal).S.copy((yyvsp[-10].TypeVal).S.get(0).get(0)); 
 }
 (yyvsp[-9].ValIDVal).S.makeComposite(FTySign);
 Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal));   // Get the function we're 
calling...
@@ -5903,7 +5906,7 @@
 break;
 
   case 268:
-#line 3329 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3332 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.TermInstVal).TI = new UnwindInst();
 (yyval.TermInstVal).S.makeSignless();
@@ -5911,7 +5914,7 @@
 break;
 
   case 269:
-#line  "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3336 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.TermInstVal).TI = new UnreachableInst();
 (yyval.TermInstVal).S.makeSignless();
@@ -5919,7 +5922,7 @@
 break;
 
   case 270:
-#line 3340 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3343 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.JumpTable) = (yyvsp[-5].JumpTable);
 (yyvsp[-3].ValIDVal).S.copy((yyvsp[-4].PrimType).S);
@@ -5935,7 +5938,7 @@
 break;
 
   case 271:
-#line 3352 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3355 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.JumpTable) = new std::vector >();
 (yyvsp[-3].ValIDVal).S.copy((yyvsp[-4].PrimType).S);
@@ -5951,7 +5954,7 @@
 break;
 
   case 272:
-#line 3367 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3370 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 bool omit = false;
 if ((yyvsp[-1].StrVal))
@@ -5984,7 +5987,7 @@
 break;
 
   case 273:
-#line 3397 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3400 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {// Used for PHI nodes
 (yyval.PHIList).P = new std::list >();
 (yyval.PHIList).S.copy((yyvsp[-5].TypeVal).S);
@@ -5998,7 +6001,7 @@
 break;
 
   case 274:
-#line 3407 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3410 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.PHIList) = (yyvsp[-6].PHIList);
 (yyvsp[-3].ValIDVal).S.copy((yyvsp[-6].PHIList).S);
@@ -6010,7 +6013,7 @@
 break;
 
   case 275:
-#line 3417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3420 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {// Used for call statements, and memory insts...
 (yyval.ValueList) = new std::vector();
 (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
@@ -6018,7 +6021,7 @@
 break;
 
   case 276:
-#line 3421 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 3424 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
 {
 (yyval.ValueList) = (yyvsp[-2].ValueList);
 

[llvm-commits] CVS: llvm-www/Users.html

2007-04-07 Thread John Criswell


Changes in directory llvm-www:

Users.html updated: 1.14 -> 1.15
---
Log message:

Changed from Cray to Cray Inc.


---
Diffs of the changes:  (+2 -2)

 Users.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-www/Users.html
diff -u llvm-www/Users.html:1.14 llvm-www/Users.html:1.15
--- llvm-www/Users.html:1.14Sat Apr  7 10:04:37 2007
+++ llvm-www/Users.html Sat Apr  7 11:22:50 2007
@@ -46,7 +46,7 @@
 
   
   
-Cray
+Cray Inc.
 Backend for the Cray Cascade Compiler
   
 
@@ -238,6 +238,6 @@
   src="http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
 
 mailto:[EMAIL PROTECTED]">LLVM Development List
-  Last modified: $Date: 2007/04/07 15:04:37 $
+  Last modified: $Date: 2007/04/07 16:22:50 $
 
 



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


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-04-07 Thread Zhou Sheng


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.106 -> 1.107
---
Log message:

Eliminate unnecessary zext/trunc stuffs.


---
Diffs of the changes:  (+10 -14)

 ScalarEvolution.cpp |   24 ++--
 1 files changed, 10 insertions(+), 14 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.106 
llvm/lib/Analysis/ScalarEvolution.cpp:1.107
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.106 Mon Apr  2 00:41:38 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Sat Apr  7 12:12:38 2007
@@ -1147,7 +1147,7 @@
 SCEVHandle ComputeIterationCount(const Loop *L);
 
 /// ComputeLoadConstantCompareIterationCount - Given an exit condition of
-/// 'setcc load X, cst', try to se if we can compute the trip count.
+/// 'setcc load X, cst', try to see if we can compute the trip count.
 SCEVHandle ComputeLoadConstantCompareIterationCount(LoadInst *LI,
 Constant *RHS,
 const Loop *L,
@@ -1342,21 +1342,19 @@
   }
 
   if (SCEVTruncateExpr *T = dyn_cast(S)) {
-APInt Mask(cast(T->getType())->getMask());
-APInt GCF(GetConstantFactor(T->getOperand()));
-Mask.zextOrTrunc(GCF.getBitWidth());
-return GCF & Mask;
+return GetConstantFactor(T->getOperand()).trunc(
+   cast(T->getType())->getBitWidth());
   }
   if (SCEVZeroExtendExpr *E = dyn_cast(S))
-return GetConstantFactor(E->getOperand());
+return GetConstantFactor(E->getOperand()).zext(
+   cast(E->getType())->getBitWidth());
   
   if (SCEVAddExpr *A = dyn_cast(S)) {
 // The result is the min of all operands.
-APInt Res = GetConstantFactor(A->getOperand(0));
+APInt Res(GetConstantFactor(A->getOperand(0)));
 for (unsigned i = 1, e = A->getNumOperands(); 
  i != e && Res.ugt(APInt(Res.getBitWidth(),1)); ++i) {
   APInt Tmp(GetConstantFactor(A->getOperand(i)));
-  Tmp.zextOrTrunc(Res.getBitWidth());
   Res = APIntOps::umin(Res, Tmp);
 }
 return Res;
@@ -1364,10 +1362,9 @@
 
   if (SCEVMulExpr *M = dyn_cast(S)) {
 // The result is the product of all the operands.
-APInt Res = GetConstantFactor(M->getOperand(0));
+APInt Res(GetConstantFactor(M->getOperand(0)));
 for (unsigned i = 1, e = M->getNumOperands(); i != e; ++i) {
   APInt Tmp(GetConstantFactor(M->getOperand(i)));
-  Tmp.zextOrTrunc(Res.getBitWidth());
   Res *= Tmp;
 }
 return Res;
@@ -1377,11 +1374,10 @@
 // For now, we just handle linear expressions.
 if (A->getNumOperands() == 2) {
   // We want the GCD between the start and the stride value.
-  APInt Start = GetConstantFactor(A->getOperand(0));
+  APInt Start(GetConstantFactor(A->getOperand(0)));
   if (Start == 1) 
-return APInt(A->getBitWidth(),1);
-  APInt Stride = GetConstantFactor(A->getOperand(1));
-  Start.zextOrTrunc(Stride.getBitWidth());
+return Start;
+  APInt Stride(GetConstantFactor(A->getOperand(1)));
   return APIntOps::GreatestCommonDivisor(Start, Stride);
 }
   }



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


Re: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl

2007-04-07 Thread Chris Lattner

On Apr 6, 2007, at 9:41 PM, Reid Spencer wrote:

> Reinstate the SVN capability without requiring Date::Parse. As  
> before the
> SVN Repository is only used if requested with -usesvn option  
> otherwise it
> uses CVS.

Woot!  Thanks guys,

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


Re: [llvm-commits] llvm-gcc build broken

2007-04-07 Thread Chris Lattner

On Apr 7, 2007, at 8:45 AM, Jeff Cohen wrote:

> Something broke it in the last 24 hours.
>
> /usr/home/jeffc/llvm-gcc/obj/gcc/xgcc
> -B/usr/home/jeffc/llvm-gcc/obj/gcc/
> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/bin/
> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/lib/ -isystem
> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/include -isystem
> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/sys-include -O2
> -DIN_GCC-W -Wall -Wwrite-strings -Wstrict-prototypes
> -Wmissing-prototypes -Wold-style-definition  -isystem ./include   - 
> fPIC
> -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../gcc
> -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include
> -I/usr/home/jeffc/llvm/include -I/home/jeffc/llvm/obj/include - 
> DL_ctzdi2
> -c ../../gcc/libgcc2.c -o libgcc/./_ctzdi2.o
> WARNING: 128-bit integers not supported!
> ../../gcc/libgcc2.c:746: internal compiler error: Segmentation  
> fault: 11
> Please submit a full bug report,

I'm seeing a similar failure in bootstrap.  The current theory is  
that this is related to Owen's loop changes.  He's working on it...

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


Re: [llvm-commits] llvm-gcc build broken

2007-04-07 Thread Jeff Cohen
I'm also seeing a bunch of regression failures from make check:

Running /usr/home/jeffc/llvm/test/Analysis/Dominators/dg.exp ...
FAIL: 
/usr/home/jeffc/llvm/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll: 

child process exited abnormally
opt: Unknown command line argument '-domset'.  Try: 'opt --help'

May I suggest that they should have been run before these changes were 
committed?

Chris Lattner wrote:
>
> On Apr 7, 2007, at 8:45 AM, Jeff Cohen wrote:
>
>> Something broke it in the last 24 hours.
>>
>> /usr/home/jeffc/llvm-gcc/obj/gcc/xgcc
>> -B/usr/home/jeffc/llvm-gcc/obj/gcc/
>> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/bin/
>> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/lib/ -isystem
>> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/include -isystem
>> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/sys-include -O2
>> -DIN_GCC-W -Wall -Wwrite-strings -Wstrict-prototypes
>> -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC
>> -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../gcc
>> -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include
>> -I/usr/home/jeffc/llvm/include -I/home/jeffc/llvm/obj/include -DL_ctzdi2
>> -c ../../gcc/libgcc2.c -o libgcc/./_ctzdi2.o
>> WARNING: 128-bit integers not supported!
>> ../../gcc/libgcc2.c:746: internal compiler error: Segmentation fault: 11
>> Please submit a full bug report,
>
> I'm seeing a similar failure in bootstrap.  The current theory is that 
> this is related to Owen's loop changes.  He's working on it...
>
> -Chris
>
>
>

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


Re: [llvm-commits] llvm-gcc build broken

2007-04-07 Thread Jeff Cohen


Jeff Cohen wrote:
> I'm also seeing a bunch of regression failures from make check:
>
> Running /usr/home/jeffc/llvm/test/Analysis/Dominators/dg.exp ...
> FAIL: 
> /usr/home/jeffc/llvm/test/Analysis/Dominators/2003-05-12-UnreachableCode.ll: 
>
> child process exited abnormally
> opt: Unknown command line argument '-domset'.  Try: 'opt --help'
>
> May I suggest that they should have been run before these changes were 
> committed?
>   

Not to mention loop related failures:

Running /usr/home/jeffc/llvm/test/Transforms/LoopSimplify/dg.exp ...
FAIL: 
/usr/home/jeffc/llvm/test/Transforms/LoopSimplify/2004-04-12-LoopSimplify-SwitchBackedges.ll:
 

child process exited abnormally
Segmentation fault (core dumped)

FAIL: 
/usr/home/jeffc/llvm/test/Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll:
 

child process exited abnormally
Segmentation fault (core dumped)

FAIL: 
/usr/home/jeffc/llvm/test/Transforms/LoopSimplify/phi-node-simplify.ll:
child process exited abnormally
llvm-dis: Standard Input is empty!
Segmentation fault (core dumped)


> Chris Lattner wrote:
>   
>> On Apr 7, 2007, at 8:45 AM, Jeff Cohen wrote:
>>
>> 
>>> Something broke it in the last 24 hours.
>>>
>>> /usr/home/jeffc/llvm-gcc/obj/gcc/xgcc
>>> -B/usr/home/jeffc/llvm-gcc/obj/gcc/
>>> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/bin/
>>> -B/home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/lib/ -isystem
>>> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/include -isystem
>>> /home/jeffc/llvm-gcc/install/amd64-unknown-freebsd6.2/sys-include -O2
>>> -DIN_GCC-W -Wall -Wwrite-strings -Wstrict-prototypes
>>> -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC
>>> -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../gcc
>>> -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include
>>> -I/usr/home/jeffc/llvm/include -I/home/jeffc/llvm/obj/include -DL_ctzdi2
>>> -c ../../gcc/libgcc2.c -o libgcc/./_ctzdi2.o
>>> WARNING: 128-bit integers not supported!
>>> ../../gcc/libgcc2.c:746: internal compiler error: Segmentation fault: 11
>>> Please submit a full bug report,
>>>   
>> I'm seeing a similar failure in bootstrap.  The current theory is that 
>> this is related to Owen's loop changes.  He's working on it...
>>
>> -Chris
>>
>>
>>
>> 
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>   

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


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-04-07 Thread Zhou Sheng


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.107 -> 1.108
---
Log message:

Make APInt variables do the computation stuffs instead of 
ConstantExpr::getXX if possible.


---
Diffs of the changes:  (+11 -14)

 ScalarEvolution.cpp |   25 +++--
 1 files changed, 11 insertions(+), 14 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.107 
llvm/lib/Analysis/ScalarEvolution.cpp:1.108
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.107 Sat Apr  7 12:12:38 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Sat Apr  7 12:40:57 2007
@@ -602,7 +602,8 @@
 assert(Idx < Ops.size());
 while (SCEVConstant *RHSC = dyn_cast(Ops[Idx])) {
   // We found two constants, fold them together!
-  Constant *Fold = ConstantExpr::getAdd(LHSC->getValue(), 
RHSC->getValue());
+  Constant *Fold = ConstantInt::get(LHSC->getValue()->getValue() + 
+RHSC->getValue()->getValue());
   if (ConstantInt *CI = dyn_cast(Fold)) {
 Ops[0] = SCEVConstant::get(CI);
 Ops.erase(Ops.begin()+1);  // Erase the folded element
@@ -839,7 +840,8 @@
 ++Idx;
 while (SCEVConstant *RHSC = dyn_cast(Ops[Idx])) {
   // We found two constants, fold them together!
-  Constant *Fold = ConstantExpr::getMul(LHSC->getValue(), 
RHSC->getValue());
+  Constant *Fold = ConstantInt::get(LHSC->getValue()->getValue() * 
+RHSC->getValue()->getValue());
   if (ConstantInt *CI = dyn_cast(Fold)) {
 Ops[0] = SCEVConstant::get(CI);
 Ops.erase(Ops.begin()+1);  // Erase the folded element
@@ -1412,10 +1414,9 @@
   // optimizations will transparently handle this case.
   if (ConstantInt *CI = dyn_cast(I->getOperand(1))) {
 SCEVHandle LHS = getSCEV(I->getOperand(0));
-APInt CommonFact = GetConstantFactor(LHS);
+APInt CommonFact(GetConstantFactor(LHS));
 assert(!CommonFact.isMinValue() &&
"Common factor should at least be 1!");
-CommonFact.zextOrTrunc(CI->getValue().getBitWidth());
 if (CommonFact.ugt(CI->getValue())) {
   // If the LHS is a multiple that is larger than the RHS, use +.
   return SCEVAddExpr::get(LHS,
@@ -1436,8 +1437,9 @@
 case Instruction::Shl:
   // Turn shift left of a constant amount into a multiply.
   if (ConstantInt *SA = dyn_cast(I->getOperand(1))) {
-Constant *X = ConstantInt::get(V->getType(), 1);
-X = ConstantExpr::getShl(X, SA);
+uint32_t BitWidth = cast(V->getType())->getBitWidth();
+Constant *X = ConstantInt::get(
+  APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth)));
 return SCEVMulExpr::get(getSCEV(I->getOperand(0)), getSCEV(X));
   }
   break;
@@ -2428,9 +2430,7 @@
  R1->getValue());
 if (Range.contains(R1Val->getValue())) {
   // The next iteration must be out of the range...
-  Constant *NextVal =
-ConstantExpr::getAdd(R1->getValue(),
- ConstantInt::get(R1->getType(), 1));
+  Constant *NextVal = ConstantInt::get(R1->getValue()->getValue()+1);
 
   R1Val = EvaluateConstantChrecAtConstant(this, NextVal);
   if (!Range.contains(R1Val->getValue()))
@@ -2440,9 +2440,7 @@
 
 // If R1 was not in the range, then it is a good return value.  Make
 // sure that R1-1 WAS in the range though, just in case.
-Constant *NextVal =
-  ConstantExpr::getSub(R1->getValue(),
-   ConstantInt::get(R1->getType(), 1));
+Constant *NextVal = ConstantInt::get(R1->getValue()->getValue()-1);
 R1Val = EvaluateConstantChrecAtConstant(this, NextVal);
 if (Range.contains(R1Val->getValue()))
   return R1;
@@ -2457,7 +2455,6 @@
   // incredibly important, we will be able to simplify the exit test a lot, and
   // we are almost guaranteed to get a trip count in this case.
   ConstantInt *TestVal = ConstantInt::get(getType(), 0);
-  ConstantInt *One = ConstantInt::get(getType(), 1);
   ConstantInt *EndVal  = TestVal;  // Stop when we wrap around.
   do {
 ++NumBruteForceEvaluations;
@@ -2470,7 +2467,7 @@
   return SCEVConstant::get(TestVal);
 
 // Increment to test the next index.
-TestVal = cast(ConstantExpr::getAdd(TestVal, One));
+TestVal = ConstantInt::get(TestVal->getValue()+1);
   } while (TestVal != EndVal);
 
   return new SCEVCouldNotCompute();



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


[llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html

2007-04-07 Thread Duncan Sands


Changes in directory llvm/docs:

LinkTimeOptimization.html updated: 1.11 -> 1.12
---
Log message:

Rephrase linker explanation.


---
Diffs of the changes:  (+5 -5)

 LinkTimeOptimization.html |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm/docs/LinkTimeOptimization.html
diff -u llvm/docs/LinkTimeOptimization.html:1.11 
llvm/docs/LinkTimeOptimization.html:1.12
--- llvm/docs/LinkTimeOptimization.html:1.11Mon Apr  2 11:54:12 2007
+++ llvm/docs/LinkTimeOptimization.html Sat Apr  7 12:43:25 2007
@@ -82,10 +82,10 @@
 
 
 
-  The following example illustrates the advantages of LTO's integrated 
-  approach and clean interface. This example requires optimization support,
-  using interface described in this document, from system linker. Here,
-  llvm-gcc4 transparantly invokes system linker. 
+  The following example illustrates the advantages of LTO's integrated
+  approach and clean interface. This example requires a system linker which
+  supports LTO through the interface described in this document.  Here,
+  llvm-gcc4 transparently invokes system linker. 
   
  Input source file a.c is compiled into LLVM byte code form.
  Input source file main.c is compiled into native object code.
@@ -385,7 +385,7 @@
 
   Devang Patel
   http://llvm.org";>LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/04/02 16:54:12 $
+  Last modified: $Date: 2007/04/07 17:43:25 $
 
 
 



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


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-04-07 Thread Zhou Sheng


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.108 -> 1.109
---
Log message:

Eliminate unnecessary APInt construction.


---
Diffs of the changes:  (+7 -8)

 ScalarEvolution.cpp |   15 +++
 1 files changed, 7 insertions(+), 8 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.108 
llvm/lib/Analysis/ScalarEvolution.cpp:1.109
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.108 Sat Apr  7 12:40:57 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Sat Apr  7 12:48:27 2007
@@ -500,7 +500,7 @@
   // Handle this case efficiently, it is common to have constant iteration
   // counts while computing loop exit values.
   if (SCEVConstant *SC = dyn_cast(V)) {
-APInt Val = SC->getValue()->getValue();
+const APInt& Val = SC->getValue()->getValue();
 APInt Result(Val.getBitWidth(), 1);
 for (; NumSteps; --NumSteps)
   Result *= Val-(NumSteps-1);
@@ -1336,7 +1336,7 @@
 /// example, turn {4,+,8} -> 4.(S umod result) should always equal zero.
 static APInt GetConstantFactor(SCEVHandle S) {
   if (SCEVConstant *C = dyn_cast(S)) {
-APInt V = C->getValue()->getValue();
+const APInt& V = C->getValue()->getValue();
 if (!V.isMinValue())
   return V;
 else   // Zero is a multiple of everything.
@@ -2096,23 +2096,22 @@
   }
 
   uint32_t BitWidth = LC->getValue()->getValue().getBitWidth();
-  APInt L(LC->getValue()->getValue());
-  APInt M(MC->getValue()->getValue());
-  APInt N(MC->getValue()->getValue());
+  const APInt& L = LC->getValue()->getValue();
+  const APInt& M = MC->getValue()->getValue();
+  const APInt& N = MC->getValue()->getValue();
   APInt Two(BitWidth, 2);
   APInt Four(BitWidth, 4);
 
   { 
 using namespace APIntOps;
-APInt C(L);
+const APInt& C = L;
 // Convert from chrec coefficients to polynomial coefficients AX^2+BX+C
 // The B coefficient is M-N/2
 APInt B(M);
 B -= sdiv(N,Two);
 
 // The A coefficient is N/2
-APInt A(N);
-A = A.sdiv(Two);
+APInt A(N.sdiv(Two));
 
 // Compute the B^2-4ac term.
 APInt SqrtTerm(B);



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


[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp

2007-04-07 Thread Owen Anderson


Changes in directory llvm/lib/VMCore:

Dominators.cpp updated: 1.86 -> 1.87
---
Log message:

Add DomSet back, and revert the changes to LoopSimplify.  Apparently the 
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.


---
Diffs of the changes:  (+109 -14)

 Dominators.cpp |  123 ++---
 1 files changed, 109 insertions(+), 14 deletions(-)


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.86 llvm/lib/VMCore/Dominators.cpp:1.87
--- llvm/lib/VMCore/Dominators.cpp:1.86 Sat Apr  7 02:17:27 2007
+++ llvm/lib/VMCore/Dominators.cpp  Sat Apr  7 13:23:27 2007
@@ -251,6 +251,113 @@
   o << "\n";
 }
 
+
+
+//===--===//
+//  DominatorSet Implementation
+//===--===//
+
+static RegisterPass
+B("domset", "Dominator Set Construction", true);
+
+// dominates - Return true if A dominates B.  This performs the special checks
+// necessary if A and B are in the same basic block.
+//
+bool DominatorSetBase::dominates(Instruction *A, Instruction *B) const {
+  BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
+  if (BBA != BBB) return dominates(BBA, BBB);
+
+  // It is not possible to determine dominance between two PHI nodes 
+  // based on their ordering.
+  if (isa(A) && isa(B)) 
+return false;
+
+  // Loop through the basic block until we find A or B.
+  BasicBlock::iterator I = BBA->begin();
+  for (; &*I != A && &*I != B; ++I) /*empty*/;
+
+  if(!IsPostDominators) {
+// A dominates B if it is found first in the basic block.
+return &*I == A;
+  } else {
+// A post-dominates B if B is found first in the basic block.
+return &*I == B;
+  }
+}
+
+
+// runOnFunction - This method calculates the forward dominator sets for the
+// specified function.
+//
+bool DominatorSet::runOnFunction(Function &F) {
+  BasicBlock *Root = &F.getEntryBlock();
+  Roots.clear();
+  Roots.push_back(Root);
+  assert(pred_begin(Root) == pred_end(Root) &&
+ "Root node has predecessors in function!");
+
+  ImmediateDominators &ID = getAnalysis();
+  Doms.clear();
+  if (Roots.empty()) return false;
+
+  // Root nodes only dominate themselves.
+  for (unsigned i = 0, e = Roots.size(); i != e; ++i)
+Doms[Roots[i]].insert(Roots[i]);
+
+  // Loop over all of the blocks in the function, calculating dominator sets 
for
+  // each function.
+  for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
+if (BasicBlock *IDom = ID[I]) {   // Get idom if block is reachable
+  DomSetType &DS = Doms[I];
+  assert(DS.empty() && "Domset already filled in for this block?");
+  DS.insert(I);  // Blocks always dominate themselves
+
+  // Insert all dominators into the set...
+  while (IDom) {
+// If we have already computed the dominator sets for our immediate
+// dominator, just use it instead of walking all the way up to the 
root.
+DomSetType &IDS = Doms[IDom];
+if (!IDS.empty()) {
+  DS.insert(IDS.begin(), IDS.end());
+  break;
+} else {
+  DS.insert(IDom);
+  IDom = ID[IDom];
+}
+  }
+} else {
+  // Ensure that every basic block has at least an empty set of nodes.  
This
+  // is important for the case when there is unreachable blocks.
+  Doms[I];
+}
+
+  return false;
+}
+
+namespace llvm {
+static std::ostream &operator<<(std::ostream &o,
+const std::set &BBs) {
+  for (std::set::const_iterator I = BBs.begin(), E = BBs.end();
+   I != E; ++I)
+if (*I)
+  WriteAsOperand(o, *I, false);
+else
+  o << " <>";
+  return o;
+}
+}
+
+void DominatorSetBase::print(std::ostream &o, const Module* ) const {
+  for (const_iterator I = begin(), E = end(); I != E; ++I) {
+o << "  DomSet For BB: ";
+if (I->first)
+  WriteAsOperand(o, I->first, false);
+else
+  o << " <>";
+o << " is:\t" << I->second << "\n";
+  }
+}
+
 
//===--===//
 //  DominatorTree Implementation
 
//===--===//
@@ -421,20 +528,6 @@
   return *Result;
 }
 
-namespace llvm {
-static std::ostream &operator<<(std::ostream &o,
-const std::set &BBs) {
-  for (std::set::const_iterator I = BBs.begin(), E = BBs.end();
-   I != E; ++I)
-if (*I)
-  WriteAsOperand(o, *I, false);
-else
-  o << " <>";
-  return o;
-}
-}
-
-
 void DominanceFrontierBase::print(std::ostream &o, const Module* ) const {
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
 o << "  DomFrontier for BB";
@@ -978,3 +1071,5 @@
   }
   o << "\n";
 }
+
+DEFINING_FILE_FOR(DominatorSet)



___

[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h

2007-04-07 Thread Owen Anderson


Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.65 -> 1.66
---
Log message:

Add DomSet back, and revert the changes to LoopSimplify.  Apparently the 
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.


---
Diffs of the changes:  (+126 -1)

 Dominators.h |  127 ++-
 1 files changed, 126 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.65 
llvm/include/llvm/Analysis/Dominators.h:1.66
--- llvm/include/llvm/Analysis/Dominators.h:1.65Sat Apr  7 02:17:27 2007
+++ llvm/include/llvm/Analysis/Dominators.h Sat Apr  7 13:23:27 2007
@@ -10,7 +10,8 @@
 // This file defines the following classes:
 //  1. ImmediateDominators: Calculates and holds a mapping between BasicBlocks
 // and their immediate dominator.
-//  2. DominatorTree: Represent the ImmediateDominator as an explicit tree
+//  2. DominatorSet: Calculates the [reverse] dominator set for a function
+//  3. DominatorTree: Represent the ImmediateDominator as an explicit tree
 // structure.
 //  4. ETForest: Efficient data structure for dominance comparisons and 
 // nearest-common-ancestor queries.
@@ -174,6 +175,127 @@
   void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo);
 };
 
+
+
+//===--===//
+/// DominatorSet - Maintain a set for every basic block in a
+/// function, that represents the blocks that dominate the block.  If the block
+/// is unreachable in this function, the set will be empty.  This cannot happen
+/// for reachable code, because every block dominates at least itself.
+///
+class DominatorSetBase : public DominatorBase {
+public:
+  typedef std::set DomSetType;// Dom set for a bb
+  // Map of dom sets
+  typedef std::map DomSetMapType;
+protected:
+  DomSetMapType Doms;
+public:
+  DominatorSetBase(bool isPostDom) : DominatorBase(isPostDom) {}
+
+  virtual void releaseMemory() { Doms.clear(); }
+
+  // Accessor interface:
+  typedef DomSetMapType::const_iterator const_iterator;
+  typedef DomSetMapType::iterator iterator;
+  inline const_iterator begin() const { return Doms.begin(); }
+  inline   iterator begin()   { return Doms.begin(); }
+  inline const_iterator end()   const { return Doms.end(); }
+  inline   iterator end() { return Doms.end(); }
+  inline const_iterator find(BasicBlock* B) const { return Doms.find(B); }
+  inline   iterator find(BasicBlock* B)   { return Doms.find(B); }
+
+
+  /// getDominators - Return the set of basic blocks that dominate the 
specified
+  /// block.
+  ///
+  inline const DomSetType &getDominators(BasicBlock *BB) const {
+const_iterator I = find(BB);
+assert(I != end() && "BB not in function!");
+return I->second;
+  }
+
+  /// isReachable - Return true if the specified basicblock is reachable.  If
+  /// the block is reachable, we have dominator set information for it.
+  ///
+  bool isReachable(BasicBlock *BB) const {
+return !getDominators(BB).empty();
+  }
+
+  /// dominates - Return true if A dominates B.
+  ///
+  inline bool dominates(BasicBlock *A, BasicBlock *B) const {
+return getDominators(B).count(A) != 0;
+  }
+
+  /// properlyDominates - Return true if A dominates B and A != B.
+  ///
+  bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
+return dominates(A, B) && A != B;
+  }
+
+  /// print - Convert to human readable form
+  ///
+  virtual void print(std::ostream &OS, const Module* = 0) const;
+  void print(std::ostream *OS, const Module* M = 0) const {
+if (OS) print(*OS, M);
+  }
+
+  /// dominates - Return true if A dominates B.  This performs the special
+  /// checks necessary if A and B are in the same basic block.
+  ///
+  bool dominates(Instruction *A, Instruction *B) const;
+
+  
//======//
+  // API to update (Post)DominatorSet information based on modifications to
+  // the CFG...
+
+  /// addBasicBlock - Call to update the dominator set with information about a
+  /// new block that was inserted into the function.
+  ///
+  void addBasicBlock(BasicBlock *BB, const DomSetType &Dominators) {
+assert(find(BB) == end() && "Block already in DominatorSet!");
+Doms.insert(std::make_pair(BB, Dominators));
+  }
+
+  /// addDominator - If a new block is inserted into the CFG, then method may 
be
+  /// called to notify the blocks it dominates that it is in their set.
+  ///
+  void addDominator(BasicBlock *BB, BasicBlock *NewDominator) {
+iterator I = find(BB);
+assert(I != end() && "BB is not in DominatorSet!");
+I->second.insert(NewDominator);
+  }
+};
+
+
+//===-
+/// DominatorSet Class - Concrete subclass of DominatorSetBase that is used to
+/// compute a nor

[llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp

2007-04-07 Thread Owen Anderson


Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.82 -> 1.83
---
Log message:

Add DomSet back, and revert the changes to LoopSimplify.  Apparently the 
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.


---
Diffs of the changes:  (+85 -48)

 LoopSimplify.cpp |  133 +++
 1 files changed, 85 insertions(+), 48 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.82 
llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.83
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.82 Sat Apr  7 01:56:47 2007
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp  Sat Apr  7 13:23:27 2007
@@ -64,10 +64,12 @@
 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
   // We need loop information to identify the loops...
   AU.addRequired();
+  AU.addRequired();
   AU.addRequired();
   AU.addRequired();
 
   AU.addPreserved();
+  AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();
@@ -312,7 +314,7 @@
   // Can we eliminate this phi node now?
   if (Value *V = PN->hasConstantValue(true)) {
 if (!isa(V) ||
-getAnalysis().dominates(cast(V), PN)) {
+getAnalysis().dominates(cast(V), PN)) {
   PN->replaceAllUsesWith(V);
   if (AA) AA->deleteValue(PN);
   BB->getInstList().erase(PN);
@@ -540,9 +542,10 @@
 
   // Determine which blocks should stay in L and which should be moved out to
   // the Outer loop now.
+  DominatorSet &DS = getAnalysis();
   std::set BlocksInL;
   for (pred_iterator PI = pred_begin(Header), E = pred_end(Header); PI!=E; 
++PI)
-if (EF->dominates(Header, *PI))
+if (DS.dominates(Header, *PI))
   AddBlockAndPredsToSet(*PI, Header, BlocksInL);
 
 
@@ -690,8 +693,33 @@
  ++succ_begin(NewBB) == succ_end(NewBB) &&
  "NewBB should have a single successor!");
   BasicBlock *NewBBSucc = *succ_begin(NewBB);
-  ETForest& ETF = getAnalysis();
-  
+  DominatorSet &DS = getAnalysis();
+
+  // Update dominator information...  The blocks that dominate NewBB are the
+  // intersection of the dominators of predecessors, plus the block itself.
+  //
+  DominatorSet::DomSetType NewBBDomSet = DS.getDominators(PredBlocks[0]);
+  {
+unsigned i, e = PredBlocks.size();
+// It is possible for some preds to not be reachable, and thus have empty
+// dominator sets (all blocks must dom themselves, so no domset would
+// otherwise be empty).  If we see any of these, don't intersect with them,
+// as that would certainly leave the resultant set empty.
+for (i = 1; NewBBDomSet.empty(); ++i) {
+  assert(i != e && "Didn't find reachable pred?");
+  NewBBDomSet = DS.getDominators(PredBlocks[i]);
+}
+
+// Intersect the rest of the non-empty sets.
+for (; i != e; ++i) {
+  const DominatorSet::DomSetType &PredDS = DS.getDominators(PredBlocks[i]);
+  if (!PredDS.empty())
+set_intersect(NewBBDomSet, PredDS);
+}
+NewBBDomSet.insert(NewBB);  // All blocks dominate themselves.
+DS.addBasicBlock(NewBB, NewBBDomSet);
+  }
+
   // The newly inserted basic block will dominate existing basic blocks iff the
   // PredBlocks dominate all of the non-pred blocks.  If all predblocks 
dominate
   // the non-pred blocks, then they all must be the same block!
@@ -700,14 +728,13 @@
   {
 BasicBlock *OnePred = PredBlocks[0];
 unsigned i, e = PredBlocks.size();
-for (i = 1; !ETF.dominates(&OnePred->getParent()->getEntryBlock(), 
OnePred); ++i) {
+for (i = 1; !DS.isReachable(OnePred); ++i) {
   assert(i != e && "Didn't find reachable pred?");
   OnePred = PredBlocks[i];
 }
 
 for (; i != e; ++i)
-  if (PredBlocks[i] != OnePred &&
-  ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), 
OnePred)) {
+  if (PredBlocks[i] != OnePred && DS.isReachable(PredBlocks[i])) {
 NewBBDominatesNewBBSucc = false;
 break;
   }
@@ -715,7 +742,7 @@
 if (NewBBDominatesNewBBSucc)
   for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc);
PI != E; ++PI)
-if (*PI != NewBB && !ETF.dominates(NewBBSucc, *PI)) {
+if (*PI != NewBB && !DS.dominates(NewBBSucc, *PI)) {
   NewBBDominatesNewBBSucc = false;
   break;
 }
@@ -728,31 +755,44 @@
 NewBBDominatesNewBBSucc = true;
 for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc);
  PI != E; ++PI)
-  if (*PI != NewBB && !ETF.dominates(NewBBSucc, *PI)) {
+  if (*PI != NewBB && !DS.dominates(NewBBSucc, *PI)) {
 NewBBDominatesNewBBSucc = false;
 break;
   }
   }
 
-  BasicBlock *NewBBIDom = 0;
-  
+  // If NewBB dominates some blocks, then it will dominate all blocks that
+  // NewBBSucc does.
+

Re: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp

2007-04-07 Thread Jeff Cohen
Still have two regressions:

Running /usr/home/jeffc/llvm/test/Other/dg.exp ...
FAIL: /usr/home/jeffc/llvm/test/Other/2002-01-31-PostDomSet-2.ll:
child process exited abnormally
opt: Unknown command line argument '-postdomset'.  Try: 'opt --help'

FAIL: /usr/home/jeffc/llvm/test/Other/2002-01-31-PostDomSet.ll:
child process exited abnormally
opt: Unknown command line argument '-postdomset'.  Try: 'opt --help'



Owen Anderson wrote:
> Changes in directory llvm/lib/Transforms/Utils:
>
> LoopSimplify.cpp updated: 1.82 -> 1.83
> ---
> Log message:
>
> Add DomSet back, and revert the changes to LoopSimplify.  Apparently the 
> ETForest updating mechanisms don't work as I thought they did.  These changes
> will be reapplied once the issue is worked out.
>
>
> ---
> Diffs of the changes:  (+85 -48)
>
>  LoopSimplify.cpp |  133 
> +++
>  1 files changed, 85 insertions(+), 48 deletions(-)
>
>
> Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
> diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.82 
> llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.83
> --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.82   Sat Apr  7 01:56:47 2007
> +++ llvm/lib/Transforms/Utils/LoopSimplify.cppSat Apr  7 13:23:27 2007
> @@ -64,10 +64,12 @@
>  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
>// We need loop information to identify the loops...
>AU.addRequired();
> +  AU.addRequired();
>AU.addRequired();
>AU.addRequired();
>  
>AU.addPreserved();
> +  AU.addPreserved();
>AU.addPreserved();
>AU.addPreserved();
>AU.addPreserved();
> @@ -312,7 +314,7 @@
>// Can we eliminate this phi node now?
>if (Value *V = PN->hasConstantValue(true)) {
>  if (!isa(V) ||
> -getAnalysis().dominates(cast(V), PN)) {
> +getAnalysis().dominates(cast(V), PN)) 
> {
>PN->replaceAllUsesWith(V);
>if (AA) AA->deleteValue(PN);
>BB->getInstList().erase(PN);
> @@ -540,9 +542,10 @@
>  
>// Determine which blocks should stay in L and which should be moved out to
>// the Outer loop now.
> +  DominatorSet &DS = getAnalysis();
>std::set BlocksInL;
>for (pred_iterator PI = pred_begin(Header), E = pred_end(Header); PI!=E; 
> ++PI)
> -if (EF->dominates(Header, *PI))
> +if (DS.dominates(Header, *PI))
>AddBlockAndPredsToSet(*PI, Header, BlocksInL);
>  
>  
> @@ -690,8 +693,33 @@
>   ++succ_begin(NewBB) == succ_end(NewBB) &&
>   "NewBB should have a single successor!");
>BasicBlock *NewBBSucc = *succ_begin(NewBB);
> -  ETForest& ETF = getAnalysis();
> -  
> +  DominatorSet &DS = getAnalysis();
> +
> +  // Update dominator information...  The blocks that dominate NewBB are the
> +  // intersection of the dominators of predecessors, plus the block itself.
> +  //
> +  DominatorSet::DomSetType NewBBDomSet = DS.getDominators(PredBlocks[0]);
> +  {
> +unsigned i, e = PredBlocks.size();
> +// It is possible for some preds to not be reachable, and thus have empty
> +// dominator sets (all blocks must dom themselves, so no domset would
> +// otherwise be empty).  If we see any of these, don't intersect with 
> them,
> +// as that would certainly leave the resultant set empty.
> +for (i = 1; NewBBDomSet.empty(); ++i) {
> +  assert(i != e && "Didn't find reachable pred?");
> +  NewBBDomSet = DS.getDominators(PredBlocks[i]);
> +}
> +
> +// Intersect the rest of the non-empty sets.
> +for (; i != e; ++i) {
> +  const DominatorSet::DomSetType &PredDS = 
> DS.getDominators(PredBlocks[i]);
> +  if (!PredDS.empty())
> +set_intersect(NewBBDomSet, PredDS);
> +}
> +NewBBDomSet.insert(NewBB);  // All blocks dominate themselves.
> +DS.addBasicBlock(NewBB, NewBBDomSet);
> +  }
> +
>// The newly inserted basic block will dominate existing basic blocks iff 
> the
>// PredBlocks dominate all of the non-pred blocks.  If all predblocks 
> dominate
>// the non-pred blocks, then they all must be the same block!
> @@ -700,14 +728,13 @@
>{
>  BasicBlock *OnePred = PredBlocks[0];
>  unsigned i, e = PredBlocks.size();
> -for (i = 1; !ETF.dominates(&OnePred->getParent()->getEntryBlock(), 
> OnePred); ++i) {
> +for (i = 1; !DS.isReachable(OnePred); ++i) {
>assert(i != e && "Didn't find reachable pred?");
>OnePred = PredBlocks[i];
>  }
>  
>  for (; i != e; ++i)
> -  if (PredBlocks[i] != OnePred &&
> -  ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), 
> OnePred)) {
> +  if (PredBlocks[i] != OnePred && DS.isReachable(PredBlocks[i])) {
>  NewBBDominatesNewBBSucc = false;
>  break;
>}
> @@ -715,7 +742,7 @@
>  if (NewBBDominatesNewBBSucc)
>for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc);
> PI != E; ++PI)
> - 

[llvm-commits] CVS: llvm/lib/System/Win32/Path.inc

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.63 -> 1.64
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Implement the PathWithStatus class and its use throughout lib/System.


---
Diffs of the changes:  (+15 -17)

 Path.inc |   32 +++-
 1 files changed, 15 insertions(+), 17 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.63 llvm/lib/System/Win32/Path.inc:1.64
--- llvm/lib/System/Win32/Path.inc:1.63 Thu Mar 29 14:05:44 2007
+++ llvm/lib/System/Win32/Path.inc  Sat Apr  7 13:52:17 2007
@@ -307,8 +307,8 @@
 }
 
 const FileStatus *
-Path::getFileStatus(bool update, std::string *ErrStr) const {
-  if (status == 0 || update) {
+PathWithStatus::getFileStatus(bool update, std::string *ErrStr) const {
+  if (!fsIsValid || update) {
 WIN32_FILE_ATTRIBUTE_DATA fi;
 if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
   MakeErrMsg(ErrStr, "getStatusInfo():" + std::string(path) +
@@ -316,30 +316,28 @@
   return 0;
 }
 
-if (status == 0)
-  status = new FileStatus;
-
-status->fileSize = fi.nFileSizeHigh;
-status->fileSize <<= sizeof(fi.nFileSizeHigh)*8;
-status->fileSize += fi.nFileSizeLow;
-
-status->mode = fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0555 : 0777;
-status->user = ;// Not applicable to Windows, so...
-status->group = ;   // Not applicable to Windows, so...
+status.fileSize = fi.nFileSizeHigh;
+status.fileSize <<= sizeof(fi.nFileSizeHigh)*8;
+status.fileSize += fi.nFileSizeLow;
+
+status.mode = fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY ? 0555 : 0777;
+status.user = ;// Not applicable to Windows, so...
+status.group = ;   // Not applicable to Windows, so...
 
 // FIXME: this is only unique if the file is accessed by the same file 
path.
 // How do we do this for C:\dir\file and ..\dir\file ? Unix has inode
 // numbers, but the concept doesn't exist in Windows.
-status->uniqueID = 0;
+status.uniqueID = 0;
 for (unsigned i = 0; i < path.length(); ++i)
-  status->uniqueID += path[i];
+  status.uniqueID += path[i];
 
 __int64 ft = *reinterpret_cast<__int64*>(&fi.ftLastWriteTime);
-status->modTime.fromWin32Time(ft);
+status.modTime.fromWin32Time(ft);
 
-status->isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+status.isDir = fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
+fsIsValid = true;
   }
-  return status;
+  return &status;
 }
 
 bool Path::makeReadableOnDisk(std::string* ErrMsg) {



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


[llvm-commits] CVS: llvm/lib/System/Unix/Path.inc Signals.inc

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/System/Unix:

Path.inc updated: 1.61 -> 1.62
Signals.inc updated: 1.16 -> 1.17
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Implement the PathWithStatus class and its use throughout lib/System.


---
Diffs of the changes:  (+54 -47)

 Path.inc|   89 ++--
 Signals.inc |   12 ++--
 2 files changed, 54 insertions(+), 47 deletions(-)


Index: llvm/lib/System/Unix/Path.inc
diff -u llvm/lib/System/Unix/Path.inc:1.61 llvm/lib/System/Unix/Path.inc:1.62
--- llvm/lib/System/Unix/Path.inc:1.61  Thu Mar 29 14:05:44 2007
+++ llvm/lib/System/Unix/Path.inc   Sat Apr  7 13:52:17 2007
@@ -333,10 +333,10 @@
 Path::canExecute() const {
   if (0 != access(path.c_str(), R_OK | X_OK ))
 return false;
-  if (const FileStatus *fs = getFileStatus(true, 0)) {
-if (!S_ISREG(fs->mode))
-  return false;
-  } else
+  struct stat buf;
+  if (0 != stat(path.c_str(), &buf))
+return false;
+  if (!S_ISREG(buf.st_mode))
 return false;
   return true;
 }
@@ -363,26 +363,25 @@
   return path.substr(pos+1);
 }
 
-const FileStatus*
-Path::getFileStatus(bool update, std::string *ErrStr) const {
-  if (status == 0 || update) {
+const FileStatus *
+PathWithStatus::getFileStatus(bool update, std::string *ErrStr) const {
+  if (!fsIsValid || update) {
 struct stat buf;
 if (0 != stat(path.c_str(), &buf)) {
   MakeErrMsg(ErrStr, path + ": can't get status of file");
   return 0;
 }
-if (status == 0)
-  status = new FileStatus;
-status->fileSize = buf.st_size;
-status->modTime.fromEpochTime(buf.st_mtime);
-status->mode = buf.st_mode;
-status->user = buf.st_uid;
-status->group = buf.st_gid;
-status->uniqueID = uint64_t(buf.st_ino);
-status->isDir  = S_ISDIR(buf.st_mode);
-status->isFile = S_ISREG(buf.st_mode);
+status.fileSize = buf.st_size;
+status.modTime.fromEpochTime(buf.st_mtime);
+status.mode = buf.st_mode;
+status.user = buf.st_uid;
+status.group = buf.st_gid;
+status.uniqueID = uint64_t(buf.st_ino);
+status.isDir  = S_ISDIR(buf.st_mode);
+status.isFile = S_ISREG(buf.st_mode);
+fsIsValid = true;
   }
-  return status;
+  return &status;
 }
 
 static bool AddPermissionBits(const Path &File, int bits) {
@@ -394,14 +393,13 @@
   umask(mask);// Restore the umask.
 
   // Get the file's current mode.
-  if (const FileStatus *fs = File.getFileStatus()) {
-// Change the file to have whichever permissions bits from 'bits'
-// that the umask would not disable.
-if ((chmod(File.c_str(), (fs->getMode() | (bits & ~mask == -1)
-  return false;
-  } else 
+  struct stat buf;
+  if (0 != stat(File.toString().c_str(), &buf)) 
 return false;
-
+  // Change the file to have whichever permissions bits from 'bits'
+  // that the umask would not disable.
+  if ((chmod(File.c_str(), (buf.st_mode | (bits & ~mask == -1)
+  return false;
   return true;
 }
 
@@ -594,25 +592,28 @@
 
 bool
 Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
-  FileStatus Status;
-  if (const FileStatus *Status = getFileStatus(false, ErrStr)) {
-// Note: this check catches strange situations. In all cases, LLVM should 
-// only be involved in the creation and deletion of regular files.  This 
-// check ensures that what we're trying to erase is a regular file. It 
-// effectively prevents LLVM from erasing things like /dev/null, any block 
-// special file, or other things that aren't "regular" files. 
-if (Status->isFile) {
-  if (unlink(path.c_str()) != 0)
-return MakeErrMsg(ErrStr, path + ": can't destroy file");
-  return false;
-}
-
-if (!Status->isDir) {
-  if (ErrStr) *ErrStr = "not a file or directory";
-  return true;
-}
-  } else
+  // Get the status so we can determin if its a file or directory
+  struct stat buf;
+  if (0 != stat(path.c_str(), &buf)) {
+MakeErrMsg(ErrStr, path + ": can't get status of file");
 return true;
+  }
+
+  // Note: this check catches strange situations. In all cases, LLVM should 
+  // only be involved in the creation and deletion of regular files.  This 
+  // check ensures that what we're trying to erase is a regular file. It 
+  // effectively prevents LLVM from erasing things like /dev/null, any block 
+  // special file, or other things that aren't "regular" files. 
+  if (S_ISREG(buf.st_mode)) {
+if (unlink(path.c_str()) != 0)
+  return MakeErrMsg(ErrStr, path + ": can't destroy file");
+return false;
+  }
+  
+  if (!S_ISDIR(buf.st_mode)) {
+if (ErrStr) *ErrStr = "not a file or directory";
+return true;
+  }
 
   if (remove_contents) {
 // Recursively descend the directory to remove its contents.
@@ -644,7 +645,7 @@
   return false;
 }
 
-bool
+bool 
 Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const {
   struct utimbuf utb;
   utb.actime = 

[llvm-commits] CVS: llvm/include/llvm/System/MappedFile.h Path.h

2007-04-07 Thread Reid Spencer


Changes in directory llvm/include/llvm/System:

MappedFile.h updated: 1.13 -> 1.14
Path.h updated: 1.49 -> 1.50
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Implement the PathWithStatus class and its use throughout lib/System.


---
Diffs of the changes:  (+89 -26)

 MappedFile.h |2 -
 Path.h   |  113 +--
 2 files changed, 89 insertions(+), 26 deletions(-)


Index: llvm/include/llvm/System/MappedFile.h
diff -u llvm/include/llvm/System/MappedFile.h:1.13 
llvm/include/llvm/System/MappedFile.h:1.14
--- llvm/include/llvm/System/MappedFile.h:1.13  Sun Aug 27 02:11:54 2006
+++ llvm/include/llvm/System/MappedFile.h   Sat Apr  7 13:52:17 2007
@@ -152,7 +152,7 @@
   /// @name Data
   /// @{
   private:
-sys::Path path_;   ///< Path to the file.
+sys::PathWithStatus path_;   ///< Path to the file.
 int options_;  ///< Options used to create the mapping
 void* base_;   ///< Pointer to the base memory address
 mutable MappedFileInfo* info_; ///< Platform specific info for the mapping


Index: llvm/include/llvm/System/Path.h
diff -u llvm/include/llvm/System/Path.h:1.49 
llvm/include/llvm/System/Path.h:1.50
--- llvm/include/llvm/System/Path.h:1.49Wed Apr  4 01:29:49 2007
+++ llvm/include/llvm/System/Path.h Sat Apr  7 13:52:17 2007
@@ -29,9 +29,9 @@
   /// platform independent and eliminates many of the unix-specific fields.
   /// However, to support llvm-ar, the mode, user, and group fields are
   /// retained. These pertain to unix security and may not have a meaningful
-  /// value on non-Unix platforms. However, the fileSize and modTime fields
-  /// should always be applicable on all platforms.  The structure is
-  /// filled in by the Path::getFileStatus method.
+  /// value on non-Unix platforms. However, the other fields fields should 
+  /// always be applicable on all platforms.  The structure is filled in by 
+  /// the PathWithStatus class.
   /// @brief File status structure
   class FileStatus {
   public:
@@ -164,16 +164,15 @@
   /// provided so that they can be used to indicate null or error results 
in
   /// other lib/System functionality.
   /// @brief Construct an empty (and invalid) path.
-  Path() : path(), status(0) {}
-  ~Path() { delete status; }
-  Path(const Path &that) : path(that.path), status(0) {}
+  Path() : path() {}
+  Path(const Path &that) : path(that.path) {}
 
   /// This constructor will accept a std::string as a path. No checking is
   /// done on this path to determine if it is valid. To determine validity
   /// of the path, use the isValid method. 
   /// @param p The path to assign.
   /// @brief Construct a Path from a string.
-  explicit Path(const std::string& p) : path(p), status(0) {}
+  explicit Path(const std::string& p) : path(p) {}
 
 /// @}
 /// @name Operators
@@ -184,9 +183,6 @@
   /// @brief Assignment Operator
   Path &operator=(const Path &that) {
 path = that.path;
-if (status)
-  delete status;
-status = 0;
 return *this;
   }
 
@@ -230,8 +226,8 @@
   /// This function determines if the contents of the path name are empty. 
   /// That is, the path name has a zero length. This does NOT determine if
   /// if the file is empty. To get the length of the file itself, Use the 
-  /// getFileStatus() method and then the getSize() on the returned
-  /// FileStatus object
+  /// PathWithStatus::getFileStatus() method and then the getSize() method 
+  /// on the returned FileStatus object.
   /// @returns true iff the path is empty.
   /// @brief Determines if the path name is empty (invalid).
   bool isEmpty() const { return path.empty(); }
@@ -361,17 +357,6 @@
 std::string* ErrMsg///< Optional place to return an error message.
   ) const;
 
-  /// This function returns status information about the file. The type of
-  /// path (file or directory) is updated to reflect the actual contents
-  /// of the file system.
-  /// @returns 0 on failure, with Error explaining why (if non-zero)
-  /// @returns a pointer to a FileStatus structure on success.
-  /// @brief Get file status.
-  const FileStatus *getFileStatus(
-bool forceUpdate = false, ///< Force an update from the file system
-std::string *Error = 0///< Optional place to return an error msg.
-  ) const;
-
 /// @}
 /// @name Path Mutators
 /// @{
@@ -527,9 +512,85 @@
 /// @}
 /// @name Data
 /// @{
-private:
+protected:
   mutable std::string path;   ///< Storage for the path name.
-  mutable FileStatus *status; ///< Status information.
+
+/// @}
+  };
+
+  /// This class is identical to Path class except it allows you to obtain the
+  /// file status of the Path as well. The reason for the distinction is one of
+

[llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-ar:

llvm-ar.cpp updated: 1.42 -> 1.43
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


---
Diffs of the changes:  (+6 -3)

 llvm-ar.cpp |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)


Index: llvm/tools/llvm-ar/llvm-ar.cpp
diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.42 llvm/tools/llvm-ar/llvm-ar.cpp:1.43
--- llvm/tools/llvm-ar/llvm-ar.cpp:1.42 Thu Mar 29 14:05:44 2007
+++ llvm/tools/llvm-ar/llvm-ar.cpp  Sat Apr  7 13:53:16 2007
@@ -281,7 +281,8 @@
 for (std::set::iterator I = content.begin(), E = content.end();
  I != E; ++I) {
   // Make sure it exists and is a directory
-  const sys::FileStatus *Status = I->getFileStatus(false, ErrMsg);
+  const sys::FileStatus *Status =
+sys::PathWithStatus(*I).getFileStatus(false, ErrMsg);
   if (!Status)
 return true;
   if (Status->isDir) {
@@ -309,7 +310,8 @@
   if (!aPath.exists())
 throw std::string("File does not exist: ") + Members[i];
   std::string Err;
-  const sys::FileStatus *si = aPath.getFileStatus(false, &Err);
+  const sys::FileStatus *si = 
+sys::PathWithStatus(aPath).getFileStatus(false, &Err);
   if (!si)
 throw Err;
   if (si->isDir) {
@@ -645,7 +647,8 @@
 
 if (found != remaining.end()) {
   std::string Err;
-  const sys::FileStatus *si = found->getFileStatus(false, &Err);
+  const sys::FileStatus *si = 
+sys::PathWithStatus(*found).getFileStatus(false, &Err);
   if (!si)
 return true;
   if (si->isDir) {



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


[llvm-commits] CVS: llvm/tools/llvm-db/Commands.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-db:

Commands.cpp updated: 1.11 -> 1.12
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


---
Diffs of the changes:  (+2 -1)

 Commands.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/tools/llvm-db/Commands.cpp
diff -u llvm/tools/llvm-db/Commands.cpp:1.11 
llvm/tools/llvm-db/Commands.cpp:1.12
--- llvm/tools/llvm-db/Commands.cpp:1.11Thu Mar 29 14:05:44 2007
+++ llvm/tools/llvm-db/Commands.cpp Sat Apr  7 13:53:16 2007
@@ -51,7 +51,8 @@
   // If the program has been modified, reload it!
   sys::Path Program(Dbg.getProgramPath());
   std::string Err;
-  const sys::FileStatus *Status = Program.getFileStatus(false, &Err);
+  const sys::FileStatus *Status = 
+sys::PathWithStatus(Program).getFileStatus(false, &Err);
   if (!Status)
 throw Err;
   if (TheProgramInfo->getProgramTimeStamp() != Status->getTimestamp()) {



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


[llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/Support:

FileUtilities.cpp updated: 1.55 -> 1.56
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


---
Diffs of the changes:  (+2 -2)

 FileUtilities.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.55 
llvm/lib/Support/FileUtilities.cpp:1.56
--- llvm/lib/Support/FileUtilities.cpp:1.55 Thu Mar 29 14:05:44 2007
+++ llvm/lib/Support/FileUtilities.cpp  Sat Apr  7 13:53:16 2007
@@ -148,8 +148,8 @@
 /// error occurs, allowing the caller to distinguish between a failed diff and 
a
 /// file system error.
 ///
-int llvm::DiffFilesWithTolerance(const sys::Path &FileA,
- const sys::Path &FileB,
+int llvm::DiffFilesWithTolerance(const sys::PathWithStatus &FileA,
+ const sys::PathWithStatus &FileB,
  double AbsTol, double RelTol,
  std::string *Error) {
   const sys::FileStatus *FileAStat = FileA.getFileStatus(false, Error);



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


[llvm-commits] CVS: llvm/tools/llvmc/CompilerDriver.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/tools/llvmc:

CompilerDriver.cpp updated: 1.46 -> 1.47
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


---
Diffs of the changes:  (+2 -1)

 CompilerDriver.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/tools/llvmc/CompilerDriver.cpp
diff -u llvm/tools/llvmc/CompilerDriver.cpp:1.46 
llvm/tools/llvmc/CompilerDriver.cpp:1.47
--- llvm/tools/llvmc/CompilerDriver.cpp:1.46Thu Mar 29 14:05:44 2007
+++ llvm/tools/llvmc/CompilerDriver.cpp Sat Apr  7 13:53:16 2007
@@ -195,7 +195,8 @@
 
   void cleanup() {
 if (!isSet(KEEP_TEMPS_FLAG)) {
-  const sys::FileStatus *Status = TempDir.getFileStatus();
+  const sys::FileStatus *Status = 
+sys::PathWithStatus(TempDir).getFileStatus();
   if (Status && Status->isDir)
 TempDir.eraseFromDisk(/*remove_contents=*/true);
 } else {



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


[llvm-commits] CVS: llvm/lib/Debugger/ProgramInfo.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/Debugger:

ProgramInfo.cpp updated: 1.21 -> 1.22
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change uses of sys::Path class to sys::PathWithStatus in those places where
the file status information is needed.


---
Diffs of the changes:  (+1 -1)

 ProgramInfo.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Debugger/ProgramInfo.cpp
diff -u llvm/lib/Debugger/ProgramInfo.cpp:1.21 
llvm/lib/Debugger/ProgramInfo.cpp:1.22
--- llvm/lib/Debugger/ProgramInfo.cpp:1.21  Thu Mar 29 14:05:44 2007
+++ llvm/lib/Debugger/ProgramInfo.cpp   Sat Apr  7 13:53:16 2007
@@ -195,7 +195,7 @@
 ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
   assert(M && "Cannot create program information with a null module!");
   const sys::FileStatus *Stat;
-  Stat = sys::Path(M->getModuleIdentifier()).getFileStatus();
+  Stat = sys::PathWithStatus(M->getModuleIdentifier()).getFileStatus();
   if (Stat)
 ProgramTimeStamp = Stat->getTimestamp();
 



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


Re: [llvm-commits] CVS: llvm/lib/Debugger/ProgramInfo.cpp

2007-04-07 Thread Jeff Cohen
This breaks the LLVM build.  I am getting errors like:

llvm[1]: Compiling Archive.cpp for Debug build
/usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp: In member 
function 'bool llvm::ArchiveMember::replaceWith(const llvm::sys::Path&, 
std::string*)':
/usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp:119: error: 'class 
llvm::sys::Path' has no member named 'getFileStatus'


Reid Spencer wrote:
> Changes in directory llvm/lib/Debugger:
>
> ProgramInfo.cpp updated: 1.21 -> 1.22
> ---
> Log message:
>
> For PR1291: http://llvm.org/PR1291 :
> Change uses of sys::Path class to sys::PathWithStatus in those places where
> the file status information is needed.
>
>
> ---
> Diffs of the changes:  (+1 -1)
>
>  ProgramInfo.cpp |2 +-
>  1 files changed, 1 insertion(+), 1 deletion(-)
>
>
> Index: llvm/lib/Debugger/ProgramInfo.cpp
> diff -u llvm/lib/Debugger/ProgramInfo.cpp:1.21 
> llvm/lib/Debugger/ProgramInfo.cpp:1.22
> --- llvm/lib/Debugger/ProgramInfo.cpp:1.21Thu Mar 29 14:05:44 2007
> +++ llvm/lib/Debugger/ProgramInfo.cpp Sat Apr  7 13:53:16 2007
> @@ -195,7 +195,7 @@
>  ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
>assert(M && "Cannot create program information with a null module!");
>const sys::FileStatus *Stat;
> -  Stat = sys::Path(M->getModuleIdentifier()).getFileStatus();
> +  Stat = sys::PathWithStatus(M->getModuleIdentifier()).getFileStatus();
>if (Stat)
>  ProgramTimeStamp = Stat->getTimestamp();
>  
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>   

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


[llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/Bytecode/Archive:

Archive.cpp updated: 1.20 -> 1.21
---
Log message:

Fix another PathWithStatus issue.


---
Diffs of the changes:  (+2 -1)

 Archive.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Bytecode/Archive/Archive.cpp
diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.20 
llvm/lib/Bytecode/Archive/Archive.cpp:1.21
--- llvm/lib/Bytecode/Archive/Archive.cpp:1.20  Wed Apr  4 01:31:04 2007
+++ llvm/lib/Bytecode/Archive/Archive.cpp   Sat Apr  7 14:45:30 2007
@@ -116,7 +116,8 @@
 path.getMagicNumber(magic,4);
 signature = magic.c_str();
 std::string err;
-const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
+const sys::FileStatus *FSinfo = 
+  sys::PathWithStatus(path).getFileStatus(false, ErrMsg);
 if (FSinfo)
   info = *FSinfo;
 else



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


Re: [llvm-commits] CVS: llvm/lib/Debugger/ProgramInfo.cpp

2007-04-07 Thread Reid Spencer
On Sat, 2007-04-07 at 12:41 -0700, Jeff Cohen wrote:
> This breaks the LLVM build.  I am getting errors like:
> 
> llvm[1]: Compiling Archive.cpp for Debug build
> /usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp: In member 
> function 'bool llvm::ArchiveMember::replaceWith(const llvm::sys::Path&, 
> std::string*)':
> /usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp:119: error: 'class 
> llvm::sys::Path' has no member named 'getFileStatus'

Somehow I missed that one. Not sure how as I did a full recompile.
ANyway, its fixed now. 

You said you had many other issue with compilation? What else?

Reid.

> 
> 
> Reid Spencer wrote:
> > Changes in directory llvm/lib/Debugger:
> >
> > ProgramInfo.cpp updated: 1.21 -> 1.22
> > ---
> > Log message:
> >
> > For PR1291: http://llvm.org/PR1291 :
> > Change uses of sys::Path class to sys::PathWithStatus in those places where
> > the file status information is needed.
> >
> >
> > ---
> > Diffs of the changes:  (+1 -1)
> >
> >  ProgramInfo.cpp |2 +-
> >  1 files changed, 1 insertion(+), 1 deletion(-)
> >
> >
> > Index: llvm/lib/Debugger/ProgramInfo.cpp
> > diff -u llvm/lib/Debugger/ProgramInfo.cpp:1.21 
> > llvm/lib/Debugger/ProgramInfo.cpp:1.22
> > --- llvm/lib/Debugger/ProgramInfo.cpp:1.21  Thu Mar 29 14:05:44 2007
> > +++ llvm/lib/Debugger/ProgramInfo.cpp   Sat Apr  7 13:53:16 2007
> > @@ -195,7 +195,7 @@
> >  ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
> >assert(M && "Cannot create program information with a null module!");
> >const sys::FileStatus *Stat;
> > -  Stat = sys::Path(M->getModuleIdentifier()).getFileStatus();
> > +  Stat = sys::PathWithStatus(M->getModuleIdentifier()).getFileStatus();
> >if (Stat)
> >  ProgramTimeStamp = Stat->getTimestamp();
> >  
> >
> >
> >
> > ___
> > llvm-commits mailing list
> > llvm-commits@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> >   
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] CVS: llvm/utils/fpcmp/fpcmp.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/utils/fpcmp:

fpcmp.cpp updated: 1.15 -> 1.16
---
Log message:

Update for PathWithStatus


---
Diffs of the changes:  (+2 -1)

 fpcmp.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/utils/fpcmp/fpcmp.cpp
diff -u llvm/utils/fpcmp/fpcmp.cpp:1.15 llvm/utils/fpcmp/fpcmp.cpp:1.16
--- llvm/utils/fpcmp/fpcmp.cpp:1.15 Thu Apr 21 19:00:37 2005
+++ llvm/utils/fpcmp/fpcmp.cpp  Sat Apr  7 14:49:35 2007
@@ -33,7 +33,8 @@
   cl::ParseCommandLineOptions(argc, argv);
 
   std::string ErrorMsg;
-  int DF = DiffFilesWithTolerance(sys::Path(File1), sys::Path(File2),
+  int DF = DiffFilesWithTolerance(sys::PathWithStatus(File1), 
+  sys::PathWithStatus(File2),
   AbsTolerance, RelTolerance, &ErrorMsg);
   if (!ErrorMsg.empty())
 std::cerr << argv[0] << ": " << ErrorMsg << "\n";



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


[llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h

2007-04-07 Thread Reid Spencer


Changes in directory llvm/include/llvm/Bytecode:

Archive.h updated: 1.20 -> 1.21
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change to use PathWithStatus


---
Diffs of the changes:  (+7 -7)

 Archive.h |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/Bytecode/Archive.h
diff -u llvm/include/llvm/Bytecode/Archive.h:1.20 
llvm/include/llvm/Bytecode/Archive.h:1.21
--- llvm/include/llvm/Bytecode/Archive.h:1.20   Wed Feb  7 15:41:01 2007
+++ llvm/include/llvm/Bytecode/Archive.hSat Apr  7 14:50:21 2007
@@ -190,13 +190,13 @@
   /// @name Data
   /// @{
   private:
-ArchiveMember* next;///< Pointer to next archive member
-ArchiveMember* prev;///< Pointer to previous archive member
-Archive*   parent;  ///< Pointer to parent archive
-sys::Path  path;///< Path of file containing the member
-sys::FileStatus info;   ///< Status info (size,mode,date)
-unsigned   flags;   ///< Flags about the archive member
-const void*data;///< Data for the member
+ArchiveMember*  next; ///< Pointer to next archive member
+ArchiveMember*  prev; ///< Pointer to previous archive member
+Archive*parent;   ///< Pointer to parent archive
+sys::PathWithStatus path; ///< Path of file containing the member
+sys::FileStatus info; ///< Status info (size,mode,date)
+unsignedflags;///< Flags about the archive member
+const void* data; ///< Data for the member
 
   /// @}
   /// @name Constructors



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


[llvm-commits] CVS: llvm/include/llvm/Support/FileUtilities.h

2007-04-07 Thread Reid Spencer


Changes in directory llvm/include/llvm/Support:

FileUtilities.h updated: 1.34 -> 1.35
---
Log message:

For PR1291: http://llvm.org/PR1291 :
Change to use PathWithStatus


---
Diffs of the changes:  (+2 -1)

 FileUtilities.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Support/FileUtilities.h
diff -u llvm/include/llvm/Support/FileUtilities.h:1.34 
llvm/include/llvm/Support/FileUtilities.h:1.35
--- llvm/include/llvm/Support/FileUtilities.h:1.34  Fri Jul 28 17:29:50 2006
+++ llvm/include/llvm/Support/FileUtilities.h   Sat Apr  7 14:50:21 2007
@@ -26,7 +26,8 @@
   /// option, it will set the string to an error message if an error occurs, or
   /// if the files are different.
   ///
-  int DiffFilesWithTolerance(const sys::Path &FileA, const sys::Path &FileB,
+  int DiffFilesWithTolerance(const sys::PathWithStatus &FileA, 
+ const sys::PathWithStatus &FileB,
  double AbsTol, double RelTol,
  std::string *Error = 0);
 



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


[llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp

2007-04-07 Thread Reid Spencer


Changes in directory llvm/lib/Bytecode/Archive:

Archive.cpp updated: 1.21 -> 1.22
---
Log message:

Avoid a useless temporary constrution.


---
Diffs of the changes:  (+1 -2)

 Archive.cpp |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/Bytecode/Archive/Archive.cpp
diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.21 
llvm/lib/Bytecode/Archive/Archive.cpp:1.22
--- llvm/lib/Bytecode/Archive/Archive.cpp:1.21  Sat Apr  7 14:45:30 2007
+++ llvm/lib/Bytecode/Archive/Archive.cpp   Sat Apr  7 14:51:45 2007
@@ -116,8 +116,7 @@
 path.getMagicNumber(magic,4);
 signature = magic.c_str();
 std::string err;
-const sys::FileStatus *FSinfo = 
-  sys::PathWithStatus(path).getFileStatus(false, ErrMsg);
+const sys::FileStatus *FSinfo = path.getFileStatus(false, ErrMsg);
 if (FSinfo)
   info = *FSinfo;
 else



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


Re: [llvm-commits] CVS: llvm/lib/Debugger/ProgramInfo.cpp

2007-04-07 Thread Reid Spencer
I found some uncommitted things in my tree. Sorry.

They are committed now.

On Sat, 2007-04-07 at 12:41 -0700, Jeff Cohen wrote:
> This breaks the LLVM build.  I am getting errors like:
> 
> llvm[1]: Compiling Archive.cpp for Debug build
> /usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp: In member 
> function 'bool llvm::ArchiveMember::replaceWith(const llvm::sys::Path&, 
> std::string*)':
> /usr/home/jeffc/llvm/lib/Bytecode/Archive/Archive.cpp:119: error: 'class 
> llvm::sys::Path' has no member named 'getFileStatus'
> 
> 
> Reid Spencer wrote:
> > Changes in directory llvm/lib/Debugger:
> >
> > ProgramInfo.cpp updated: 1.21 -> 1.22
> > ---
> > Log message:
> >
> > For PR1291: http://llvm.org/PR1291 :
> > Change uses of sys::Path class to sys::PathWithStatus in those places where
> > the file status information is needed.
> >
> >
> > ---
> > Diffs of the changes:  (+1 -1)
> >
> >  ProgramInfo.cpp |2 +-
> >  1 files changed, 1 insertion(+), 1 deletion(-)
> >
> >
> > Index: llvm/lib/Debugger/ProgramInfo.cpp
> > diff -u llvm/lib/Debugger/ProgramInfo.cpp:1.21 
> > llvm/lib/Debugger/ProgramInfo.cpp:1.22
> > --- llvm/lib/Debugger/ProgramInfo.cpp:1.21  Thu Mar 29 14:05:44 2007
> > +++ llvm/lib/Debugger/ProgramInfo.cpp   Sat Apr  7 13:53:16 2007
> > @@ -195,7 +195,7 @@
> >  ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) {
> >assert(M && "Cannot create program information with a null module!");
> >const sys::FileStatus *Stat;
> > -  Stat = sys::Path(M->getModuleIdentifier()).getFileStatus();
> > +  Stat = sys::PathWithStatus(M->getModuleIdentifier()).getFileStatus();
> >if (Stat)
> >  ProgramTimeStamp = Stat->getTimestamp();
> >  
> >
> >
> >
> > ___
> > llvm-commits mailing list
> > llvm-commits@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
> >
> >
> >   
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] CVS: llvm/test/Other/2002-01-31-PostDomSet-2.ll 2002-01-31-PostDomSet.ll

2007-04-07 Thread Chris Lattner


Changes in directory llvm/test/Other:

2002-01-31-PostDomSet-2.ll updated: 1.4 -> 1.5
2002-01-31-PostDomSet.ll updated: 1.5 -> 1.6
---
Log message:

xfail these until owen can figure out the right fix


---
Diffs of the changes:  (+2 -2)

 2002-01-31-PostDomSet-2.ll |2 +-
 2002-01-31-PostDomSet.ll   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/test/Other/2002-01-31-PostDomSet-2.ll
diff -u llvm/test/Other/2002-01-31-PostDomSet-2.ll:1.4 
llvm/test/Other/2002-01-31-PostDomSet-2.ll:1.5
--- llvm/test/Other/2002-01-31-PostDomSet-2.ll:1.4  Fri Dec  1 22:23:08 2006
+++ llvm/test/Other/2002-01-31-PostDomSet-2.ll  Sat Apr  7 15:00:36 2007
@@ -1,7 +1,7 @@
 ; Crash in post dominator set construction.
 ;
 ; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -postdomset
-;
+; XFAIL: *
 
 implementation
 


Index: llvm/test/Other/2002-01-31-PostDomSet.ll
diff -u llvm/test/Other/2002-01-31-PostDomSet.ll:1.5 
llvm/test/Other/2002-01-31-PostDomSet.ll:1.6
--- llvm/test/Other/2002-01-31-PostDomSet.ll:1.5Fri Dec  1 22:23:08 2006
+++ llvm/test/Other/2002-01-31-PostDomSet.llSat Apr  7 15:00:36 2007
@@ -1,7 +1,7 @@
 ; Crash in post dominator set construction.
 ;
 ; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -postdomset
-;
+; XFAIL: *
 
 implementation
 



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

2007-04-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.104 -> 1.105
---
Log message:

Fix an off-by-one error that broke Prolangs/deriv2 with llc on x86
and Prolangs-C/cdecl


---
Diffs of the changes:  (+1 -1)

 SimplifyLibCalls.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.104 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.105
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.104  Fri Apr  6 20:18:36 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSat Apr  7 15:19:08 2007
@@ -780,7 +780,7 @@
 // do the concatenation for us.
 Value *MemcpyOps[] = {
   Dst, Src,
-  ConstantInt::get(SLC.getIntPtrType(), SrcLen), // length including nul.
+  ConstantInt::get(SLC.getIntPtrType(), SrcLen+1), // length including nul.
   ConstantInt::get(Type::Int32Ty, 1) // alignment
 };
 new CallInst(SLC.get_memcpy(), MemcpyOps, 4, "", CI);



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


[llvm-commits] CVS: llvm/test/Other/2002-01-31-PostDomSet-2.ll 2002-01-31-PostDomSet.ll

2007-04-07 Thread Chris Lattner


Changes in directory llvm/test/Other:

2002-01-31-PostDomSet-2.ll (r1.5) removed
2002-01-31-PostDomSet.ll (r1.6) removed
---
Log message:

these test a pass that no longer exists.


---
Diffs of the changes:  (+0 -0)

 0 files changed



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


[llvm-commits] CVS: llvm/lib/System/Win32/Path.inc Signals.inc

2007-04-07 Thread Jeff Cohen


Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.64 -> 1.65
Signals.inc updated: 1.23 -> 1.24
---
Log message:

Unbreak VC++ build.

---
Diffs of the changes:  (+32 -32)

 Path.inc|   53 +
 Signals.inc |   11 +++
 2 files changed, 32 insertions(+), 32 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.64 llvm/lib/System/Win32/Path.inc:1.65
--- llvm/lib/System/Win32/Path.inc:1.64 Sat Apr  7 13:52:17 2007
+++ llvm/lib/System/Win32/Path.inc  Sat Apr  7 15:47:27 2007
@@ -368,11 +368,15 @@
 
 bool
 Path::getDirectoryContents(std::set& result, std::string* ErrMsg) const {
-  const FileStatus *Status = getFileStatus(false, ErrMsg);
-  if (!Status)
+  WIN32_FILE_ATTRIBUTE_DATA fi;
+  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
+MakeErrMsg(ErrMsg, path + ": can't get status of file");
 return true;
-  if (!Status->isDir) {
-MakeErrMsg(ErrMsg, path + ": not a directory");
+  }
+
+  if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+if (ErrMsg)
+  *ErrMsg = path + ": not a directory";
 return true;
   }
 
@@ -565,28 +569,11 @@
 
 bool
 Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
-  const FileStatus *Status = getFileStatus(false, ErrStr);
-  if (!Status)
-return false;
+  WIN32_FILE_ATTRIBUTE_DATA fi;
+  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
+return true;
 
-  if (Status->isFile) {
-DWORD attr = GetFileAttributes(path.c_str());
-
-// If it doesn't exist, we're done.
-if (attr == INVALID_FILE_ATTRIBUTES)
-  return false;
-
-// Read-only files cannot be deleted on Windows.  Must remove the read-only
-// attribute first.
-if (attr & FILE_ATTRIBUTE_READONLY) {
-  if (!SetFileAttributes(path.c_str(), attr & ~FILE_ATTRIBUTE_READONLY))
-return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
-}
-
-if (!DeleteFile(path.c_str()))
-  return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
-return false;
-  } else if (Status->isDir) {
+  if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
 // If it doesn't exist, we're done.
 if (!exists())
   return false;
@@ -645,9 +632,19 @@
   return MakeErrMsg(ErrStr, 
 std::string(pathname) + ": Can't destroy directory: ");
 return false;
-  } 
-  // It appears the path doesn't exist.
-  return true;
+  } else {
+// Read-only files cannot be deleted on Windows.  Must remove the read-only
+// attribute first.
+if (fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
+  if (!SetFileAttributes(path.c_str(),
+ fi.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY))
+return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
+}
+
+if (!DeleteFile(path.c_str()))
+  return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
+return false;
+  }
 }
 
 bool Path::getMagicNumber(std::string& Magic, unsigned len) const {


Index: llvm/lib/System/Win32/Signals.inc
diff -u llvm/lib/System/Win32/Signals.inc:1.23 
llvm/lib/System/Win32/Signals.inc:1.24
--- llvm/lib/System/Win32/Signals.inc:1.23  Thu Mar 29 14:05:44 2007
+++ llvm/lib/System/Win32/Signals.inc   Sat Apr  7 15:47:27 2007
@@ -101,12 +101,15 @@
 // RemoveDirectoryOnSignal - The public API
 bool sys::RemoveDirectoryOnSignal(const sys::Path& path, std::string* ErrMsg) {
   // Not a directory?
-  const sys::FileStatus *Status =  path.getFileStatus(false, ErrMsg);
-  if (!Status)
+  WIN32_FILE_ATTRIBUTE_DATA fi;
+  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
+MakeErrMsg(ErrMsg, path.toString() + ": can't get status of file");
 return true;
-  if (!Status->isDir) {
+  }
+
+  if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
 if (ErrMsg)
-  *ErrMsg = path.toString() + " is not a directory";
+  *ErrMsg = path.toString() + ": not a directory";
 return true;
   }
 



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


Re: [llvm-commits] CVS: llvm/lib/System/Win32/Path.inc Signals.inc

2007-04-07 Thread Reid Spencer
On Sat, 2007-04-07 at 15:47 -0500, Jeff Cohen wrote:
> 
> Changes in directory llvm/lib/System/Win32:
> 
> Path.inc updated: 1.64 -> 1.65
> Signals.inc updated: 1.23 -> 1.24
> ---
> Log message:
> 
> Unbreak VC++ build.

Thanks for cleaning up after me, Jeff. 

Reid.

> 
> ---
> Diffs of the changes:  (+32 -32)
> 
>  Path.inc|   53 +
>  Signals.inc |   11 +++
>  2 files changed, 32 insertions(+), 32 deletions(-)
> 
> 
> Index: llvm/lib/System/Win32/Path.inc
> diff -u llvm/lib/System/Win32/Path.inc:1.64 
> llvm/lib/System/Win32/Path.inc:1.65
> --- llvm/lib/System/Win32/Path.inc:1.64   Sat Apr  7 13:52:17 2007
> +++ llvm/lib/System/Win32/Path.incSat Apr  7 15:47:27 2007
> @@ -368,11 +368,15 @@
>  
>  bool
>  Path::getDirectoryContents(std::set& result, std::string* ErrMsg) 
> const {
> -  const FileStatus *Status = getFileStatus(false, ErrMsg);
> -  if (!Status)
> +  WIN32_FILE_ATTRIBUTE_DATA fi;
> +  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
> +MakeErrMsg(ErrMsg, path + ": can't get status of file");
>  return true;
> -  if (!Status->isDir) {
> -MakeErrMsg(ErrMsg, path + ": not a directory");
> +  }
> +
> +  if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
> +if (ErrMsg)
> +  *ErrMsg = path + ": not a directory";
>  return true;
>}
>  
> @@ -565,28 +569,11 @@
>  
>  bool
>  Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
> -  const FileStatus *Status = getFileStatus(false, ErrStr);
> -  if (!Status)
> -return false;
> +  WIN32_FILE_ATTRIBUTE_DATA fi;
> +  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
> +return true;
>  
> -  if (Status->isFile) {
> -DWORD attr = GetFileAttributes(path.c_str());
> -
> -// If it doesn't exist, we're done.
> -if (attr == INVALID_FILE_ATTRIBUTES)
> -  return false;
> -
> -// Read-only files cannot be deleted on Windows.  Must remove the 
> read-only
> -// attribute first.
> -if (attr & FILE_ATTRIBUTE_READONLY) {
> -  if (!SetFileAttributes(path.c_str(), attr & ~FILE_ATTRIBUTE_READONLY))
> -return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
> -}
> -
> -if (!DeleteFile(path.c_str()))
> -  return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
> -return false;
> -  } else if (Status->isDir) {
> +  if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
>  // If it doesn't exist, we're done.
>  if (!exists())
>return false;
> @@ -645,9 +632,19 @@
>return MakeErrMsg(ErrStr, 
>  std::string(pathname) + ": Can't destroy directory: ");
>  return false;
> -  } 
> -  // It appears the path doesn't exist.
> -  return true;
> +  } else {
> +// Read-only files cannot be deleted on Windows.  Must remove the 
> read-only
> +// attribute first.
> +if (fi.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
> +  if (!SetFileAttributes(path.c_str(),
> + fi.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY))
> +return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
> +}
> +
> +if (!DeleteFile(path.c_str()))
> +  return MakeErrMsg(ErrStr, path + ": Can't destroy file: ");
> +return false;
> +  }
>  }
>  
>  bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
> 
> 
> Index: llvm/lib/System/Win32/Signals.inc
> diff -u llvm/lib/System/Win32/Signals.inc:1.23 
> llvm/lib/System/Win32/Signals.inc:1.24
> --- llvm/lib/System/Win32/Signals.inc:1.23Thu Mar 29 14:05:44 2007
> +++ llvm/lib/System/Win32/Signals.inc Sat Apr  7 15:47:27 2007
> @@ -101,12 +101,15 @@
>  // RemoveDirectoryOnSignal - The public API
>  bool sys::RemoveDirectoryOnSignal(const sys::Path& path, std::string* 
> ErrMsg) {
>// Not a directory?
> -  const sys::FileStatus *Status =  path.getFileStatus(false, ErrMsg);
> -  if (!Status)
> +  WIN32_FILE_ATTRIBUTE_DATA fi;
> +  if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi)) {
> +MakeErrMsg(ErrMsg, path.toString() + ": can't get status of file");
>  return true;
> -  if (!Status->isDir) {
> +  }
> +
> +  if (!(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
>  if (ErrMsg)
> -  *ErrMsg = path.toString() + " is not a directory";
> +  *ErrMsg = path.toString() + ": not a directory";
>  return true;
>}
>  
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


[llvm-commits] CVS: llvm-test/MultiSource/Applications/siod/Makefile slibu.c

2007-04-07 Thread Jeff Cohen


Changes in directory llvm-test/MultiSource/Applications/siod:

Makefile updated: 1.8 -> 1.9
slibu.c updated: 1.5 -> 1.6
---
Log message:

Make it work on FreeBSD (and any other platform where dlopen isn't in libdl).

---
Diffs of the changes:  (+6 -2)

 Makefile |2 +-
 slibu.c  |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)


Index: llvm-test/MultiSource/Applications/siod/Makefile
diff -u llvm-test/MultiSource/Applications/siod/Makefile:1.8 
llvm-test/MultiSource/Applications/siod/Makefile:1.9
--- llvm-test/MultiSource/Applications/siod/Makefile:1.8Fri Apr 29 
03:36:36 2005
+++ llvm-test/MultiSource/Applications/siod/MakefileSat Apr  7 15:56:03 2007
@@ -1,7 +1,7 @@
 LEVEL = ../../..
 PROG = siod
 CPPFLAGS = -D__USE_MISC -D__USE_GNU -D__USE_SVID -D__USE_XOPEN_EXTENDED 
-D__USE_XOPEN -Dunix
-LDFLAGS  = -lm -ldl $(TOOLLINKOPTS)
+LDFLAGS  = -lm $(TOOLLINKOPTS)
 
 RUN_OPTIONS = -v1 $(PROJ_SRC_DIR)/test.scm
 


Index: llvm-test/MultiSource/Applications/siod/slibu.c
diff -u llvm-test/MultiSource/Applications/siod/slibu.c:1.5 
llvm-test/MultiSource/Applications/siod/slibu.c:1.6
--- llvm-test/MultiSource/Applications/siod/slibu.c:1.5 Wed Jun  2 18:06:37 2004
+++ llvm-test/MultiSource/Applications/siod/slibu.c Sat Apr  7 15:56:03 2007
@@ -98,7 +98,7 @@
 
 static void init_slibu_version(void)
 {setvar(cintern("*slibu-version*"),
-   cintern("$Id: slibu.c,v 1.5 2004/06/02 23:06:37 lattner Exp $"),
+   cintern("$Id: slibu.c,v 1.6 2007/04/07 20:56:03 jeffc Exp $"),
NIL);}
 
 
@@ -1518,6 +1518,9 @@
{put_st("so-loading ");
 put_st(get_c_string(fname));
 put_st("\n");}
+#if 0
+/* Too platform-dependent for llvm-test to handle, and the test doesn't
+ * use it anyway. */
 #if defined(__osf__) || defined(sun) || defined(linux) || defined(sgi)
 #if !defined(__osf__)
  /* Observed bug: values of LD_LIBRARY_PATH established with putenv
@@ -1565,6 +1568,7 @@
  if (!(fcn = (LPVOID)GetProcAddress(handle,get_c_string(init_name
err("GetProcAddress",init_name);
 #endif
+#endif
  if (fcn)
(*fcn)();
  else



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

2007-04-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.105 -> 1.106
---
Log message:

Change CastToCStr to take a pointer instead of a reference.
Fix some miscompilations in fprintf optimizer.


---
Diffs of the changes:  (+76 -82)

 SimplifyLibCalls.cpp |  158 ---
 1 files changed, 76 insertions(+), 82 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.105 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.106
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.105  Sat Apr  7 15:19:08 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSat Apr  7 16:04:50 2007
@@ -393,7 +393,7 @@
 // Forward declare utility functions.
 static bool GetConstantStringInfo(Value *V, ConstantArray *&Array,
   uint64_t &Length, uint64_t &StartIdx);
-static Value *CastToCStr(Value *V, Instruction &IP);
+static Value *CastToCStr(Value *V, Instruction *IP);
 
 /// This LibCallOptimization will find instances of a call to "exit" that 
occurs
 /// within the "main" function and change it to a simple "ret" instruction with
@@ -1228,7 +1228,7 @@
 return false;
 
   // printf("%s\n",str) -> puts(str)
-  new CallInst(SLC.get_puts(), CastToCStr(CI->getOperand(2), *CI),
+  new CallInst(SLC.get_puts(), CastToCStr(CI->getOperand(2), CI),
CI->getName(), CI);
   return ReplaceCallWith(CI, 0);
 }
@@ -1262,104 +1262,98 @@
   "Number of 'fprintf' calls simplified") {}
 
   /// @brief Make sure that the "fprintf" function has the right prototype
-  virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& 
SLC){
-// Just make sure this has at least 2 arguments
-return (f->arg_size() >= 2);
+  virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls 
&SLC){
+const FunctionType *FT = F->getFunctionType();
+return FT->getNumParams() == 2 &&  // two fixed arguments.
+   FT->getParamType(1) == PointerType::get(Type::Int8Ty) &&
+   isa(FT->getParamType(0)) &&
+   isa(FT->getReturnType());
   }
 
   /// @brief Perform the fprintf optimization.
-  virtual bool OptimizeCall(CallInst* ci, SimplifyLibCalls& SLC) {
+  virtual bool OptimizeCall(CallInst *CI, SimplifyLibCalls &SLC) {
 // If the call has more than 3 operands, we can't optimize it
-if (ci->getNumOperands() > 4 || ci->getNumOperands() <= 2)
-  return false;
-
-// If the result of the fprintf call is used, none of these optimizations
-// can be made.
-if (!ci->use_empty())
+if (CI->getNumOperands() != 3 && CI->getNumOperands() != 4)
   return false;
 
 // All the optimizations depend on the length of the second argument and 
the
 // fact that it is a constant string array. Check that now
-uint64_t len, StartIdx;
-ConstantArray* CA = 0;
-if (!GetConstantStringInfo(ci->getOperand(2), CA, len, StartIdx))
+uint64_t FormatLen, FormatStartIdx;
+ConstantArray *CA = 0;
+if (!GetConstantStringInfo(CI->getOperand(2), CA, 
FormatLen,FormatStartIdx))
   return false;
 
-if (ci->getNumOperands() == 3) {
+// IF fthis is just a format string, turn it into fwrite.
+if (CI->getNumOperands() == 3) {
+  if (!CA->isCString()) return false;
+  
   // Make sure there's no % in the constant array
-  for (unsigned i = 0; i < len; ++i) {
-if (ConstantInt* CI = dyn_cast(CA->getOperand(i))) {
-  // Check for the null terminator
-  if (CI->getZExtValue() == '%')
-return false; // we found end of string
-} else {
-  return false;
-}
-  }
+  std::string S = CA->getAsString();
 
-  // fprintf(file,fmt) -> fwrite(fmt,strlen(fmt),file)
-  const Type* FILEptr_type = ci->getOperand(1)->getType();
+  for (unsigned i = FormatStartIdx, e = S.size(); i != e; ++i)
+if (S[i] == '%')
+  return false; // we found a format specifier
 
-  // Make sure that the fprintf() and fwrite() functions both take the
-  // same type of char pointer.
-  if (ci->getOperand(2)->getType() != PointerType::get(Type::Int8Ty))
-return false;
+  // fprintf(file,fmt) -> fwrite(fmt,strlen(fmt),file)
+  const Type *FILEty = CI->getOperand(1)->getType();
 
-  Value* args[4] = {
-ci->getOperand(2),
-ConstantInt::get(SLC.getIntPtrType(),len),
-ConstantInt::get(SLC.getIntPtrType(),1),
-ci->getOperand(1)
+  Value *FWriteArgs[] = {
+CI->getOperand(2),
+ConstantInt::get(SLC.getIntPtrType(), FormatLen),
+ConstantInt::get(SLC.getIntPtrType(), 1),
+CI->getOperand(1)
   };
-  new CallInst(SLC.get_fwrite(FILEptr_type), args, 4, ci->getName(), ci);
-  return ReplaceCallWith(ci, ConstantInt::get(Type::Int32Ty,len));
+  new CallInst(SLC.get_fwrite(FILEty), FWriteArgs, 4, CI->ge

[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

2007-04-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.106 -> 1.107
---
Log message:

Fix problems in the sprintf optimizer


---
Diffs of the changes:  (+60 -81)

 SimplifyLibCalls.cpp |  141 +--
 1 files changed, 60 insertions(+), 81 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.106 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.107
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.106  Sat Apr  7 16:04:50 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSat Apr  7 16:17:51 2007
@@ -1276,8 +1276,7 @@
 if (CI->getNumOperands() != 3 && CI->getNumOperands() != 4)
   return false;
 
-// All the optimizations depend on the length of the second argument and 
the
-// fact that it is a constant string array. Check that now
+// All the optimizations depend on the format string.
 uint64_t FormatLen, FormatStartIdx;
 ConstantArray *CA = 0;
 if (!GetConstantStringInfo(CI->getOperand(2), CA, 
FormatLen,FormatStartIdx))
@@ -1368,108 +1367,88 @@
   SPrintFOptimization() : LibCallOptimization("sprintf",
   "Number of 'sprintf' calls simplified") {}
 
-  /// @brief Make sure that the "fprintf" function has the right prototype
-  virtual bool ValidateCalledFunction(const Function *f, SimplifyLibCalls 
&SLC){
-// Just make sure this has at least 2 arguments
-return (f->getReturnType() == Type::Int32Ty && f->arg_size() >= 2);
+  /// @brief Make sure that the "sprintf" function has the right prototype
+  virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls 
&SLC){
+const FunctionType *FT = F->getFunctionType();
+return FT->getNumParams() == 2 &&  // two fixed arguments.
+   FT->getParamType(1) == PointerType::get(Type::Int8Ty) &&
+   FT->getParamType(0) == FT->getParamType(1) &&
+   isa(FT->getReturnType());
   }
 
   /// @brief Perform the sprintf optimization.
-  virtual bool OptimizeCall(CallInst *ci, SimplifyLibCalls &SLC) {
+  virtual bool OptimizeCall(CallInst *CI, SimplifyLibCalls &SLC) {
 // If the call has more than 3 operands, we can't optimize it
-if (ci->getNumOperands() > 4 || ci->getNumOperands() < 3)
+if (CI->getNumOperands() != 3 && CI->getNumOperands() != 4)
   return false;
 
-// All the optimizations depend on the length of the second argument and 
the
-// fact that it is a constant string array. Check that now
-uint64_t len, StartIdx;
-ConstantArray* CA = 0;
-if (!GetConstantStringInfo(ci->getOperand(2), CA, len, StartIdx))
+uint64_t FormatLen, FormatStartIdx;
+ConstantArray *CA = 0;
+if (!GetConstantStringInfo(CI->getOperand(2), CA, 
FormatLen,FormatStartIdx))
   return false;
-
-if (ci->getNumOperands() == 3) {
-  if (len == 0) {
-// If the length is 0, we just need to store a null byte
-new StoreInst(ConstantInt::get(Type::Int8Ty,0),ci->getOperand(1),ci);
-return ReplaceCallWith(ci, ConstantInt::get(Type::Int32Ty,0));
-  }
-
+
+if (CI->getNumOperands() == 3) {
+  if (!CA->isCString()) return false;
+  
   // Make sure there's no % in the constant array
-  for (unsigned i = 0; i < len; ++i) {
-if (ConstantInt* CI = dyn_cast(CA->getOperand(i))) {
-  // Check for the null terminator
-  if (CI->getZExtValue() == '%')
-return false; // we found a %, can't optimize
-} else {
-  return false; // initializer is not constant int, can't optimize
-}
-  }
-
-  // Increment length because we want to copy the null byte too
-  len++;
-
+  std::string S = CA->getAsString();
+  for (unsigned i = FormatStartIdx, e = S.size(); i != e; ++i)
+if (S[i] == '%')
+  return false; // we found a format specifier
+  
   // sprintf(str,fmt) -> llvm.memcpy(str,fmt,strlen(fmt),1)
-  Value *args[4] = {
-ci->getOperand(1),
-ci->getOperand(2),
-ConstantInt::get(SLC.getIntPtrType(),len),
+  Value *MemCpyArgs[] = {
+CI->getOperand(1), CI->getOperand(2),
+ConstantInt::get(SLC.getIntPtrType(), FormatLen+1), // Copy the nul 
byte
 ConstantInt::get(Type::Int32Ty, 1)
   };
-  new CallInst(SLC.get_memcpy(), args, 4, "", ci);
-  return ReplaceCallWith(ci, ConstantInt::get(Type::Int32Ty,len));
+  new CallInst(SLC.get_memcpy(), MemCpyArgs, 4, "", CI);
+  return ReplaceCallWith(CI, ConstantInt::get(CI->getType(), FormatLen));
 }
 
-// The remaining optimizations require the format string to be length 2
-// "%s" or "%c".
-if (len != 2)
+// The remaining optimizations require the format string to be "%s" or 
"%c".
+if (FormatLen != 2 ||
+cast(CA->getOperand(FormatStartIdx))->getZExtValue() 
!='%')
   return false;
 
-// The first character has to be a %
-if (Constan

[llvm-commits] CVS: llvm-www/SVNMigration.html

2007-04-07 Thread Reid Spencer


Changes in directory llvm-www:

SVNMigration.html updated: 1.7 -> 1.8
---
Log message:

Status update.


---
Diffs of the changes:  (+6 -1)

 SVNMigration.html |7 ++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm-www/SVNMigration.html
diff -u llvm-www/SVNMigration.html:1.7 llvm-www/SVNMigration.html:1.8
--- llvm-www/SVNMigration.html:1.7  Fri Apr  6 20:43:54 2007
+++ llvm-www/SVNMigration.html  Sat Apr  7 16:19:10 2007
@@ -4,6 +4,11 @@
 
   This document contains notes about the planned migration of the CVS code
   repository to Subversion.
+  Status as of 2007-04-07All the technology is in place for the
+  migration to occur. We are now only waiting for TSG to install the 
+  authentication tokens so that existing "commit" users will be granted 
+  read/write access to the subversion repository. Migration will occur
+  next week.
   Status as of 2007-04-06Last night TSG got the repository 
   converted with the conversion script and the ViewVC service setup and 
   configured. The public read-only access is configured. Private read-write
@@ -161,6 +166,6 @@
   src="http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!">
-Last modified: $Date: 2007/04/07 01:43:54 $
+Last modified: $Date: 2007/04/07 21:19:10 $
 
 



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp

2007-04-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.107 -> 1.108
---
Log message:

Significantly simplify the clients of GetConstantStringInfo, by having it
just return the string itself.


---
Diffs of the changes:  (+153 -234)

 SimplifyLibCalls.cpp |  387 ---
 1 files changed, 153 insertions(+), 234 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.107 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.108
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.107  Sat Apr  7 16:17:51 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSat Apr  7 16:58:02 2007
@@ -391,8 +391,7 @@
 namespace {
 
 // Forward declare utility functions.
-static bool GetConstantStringInfo(Value *V, ConstantArray *&Array,
-  uint64_t &Length, uint64_t &StartIdx);
+static bool GetConstantStringInfo(Value *V, std::string &Str);
 static Value *CastToCStr(Value *V, Instruction *IP);
 
 /// This LibCallOptimization will find instances of a call to "exit" that 
occurs
@@ -465,19 +464,12 @@
 public:
 
   /// @brief Make sure that the "strcat" function has the right prototype
-  virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls& 
SLC){
-if (f->getReturnType() == PointerType::get(Type::Int8Ty))
-  if (f->arg_size() == 2)
-  {
-Function::const_arg_iterator AI = f->arg_begin();
-if (AI++->getType() == PointerType::get(Type::Int8Ty))
-  if (AI->getType() == PointerType::get(Type::Int8Ty))
-  {
-// Indicate this is a suitable call type.
-return true;
-  }
-  }
-return false;
+  virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls 
&SLC){
+const FunctionType *FT = F->getFunctionType();
+return FT->getNumParams() == 2 &&
+   FT->getReturnType() == PointerType::get(Type::Int8Ty) &&
+   FT->getParamType(0) == FT->getReturnType() &&
+   FT->getParamType(1) == FT->getReturnType();
   }
 
   /// @brief Optimize the strcat library function
@@ -488,18 +480,16 @@
 
 // Extract the initializer (while making numerous checks) from the
 // source operand of the call to strcat.
-uint64_t SrcLength, StartIdx;
-ConstantArray *Arr;
-if (!GetConstantStringInfo(Src, Arr, SrcLength, StartIdx))
+std::string SrcStr;
+if (!GetConstantStringInfo(Src, SrcStr))
   return false;
 
 // Handle the simple, do-nothing case
-if (SrcLength == 0)
+if (SrcStr.empty())
   return ReplaceCallWith(CI, Dst);
 
 // We need to find the end of the destination string.  That's where the
-// memory is to be moved to. We just generate a call to strlen (further
-// optimized in another pass).
+// memory is to be moved to. We just generate a call to strlen.
 CallInst *DstLen = new CallInst(SLC.get_strlen(), Dst,
 Dst->getName()+".len", CI);
 
@@ -512,7 +502,7 @@
 // do the concatenation for us.
 Value *Vals[] = {
   Dst, Src,
-  ConstantInt::get(SLC.getIntPtrType(), SrcLength+1), // copy nul term.
+  ConstantInt::get(SLC.getIntPtrType(), SrcStr.size()+1), // copy nul byte.
   ConstantInt::get(Type::Int32Ty, 1)  // alignment
 };
 new CallInst(SLC.get_memcpy(), Vals, 4, "", CI);
@@ -542,10 +532,8 @@
   /// @brief Perform the strchr optimizations
   virtual bool OptimizeCall(CallInst *CI, SimplifyLibCalls &SLC) {
 // Check that the first argument to strchr is a constant array of sbyte.
-// If it is, get the length and data, otherwise return false.
-uint64_t StrLength, StartIdx;
-ConstantArray *CA = 0;
-if (!GetConstantStringInfo(CI->getOperand(1), CA, StrLength, StartIdx))
+std::string Str;
+if (!GetConstantStringInfo(CI->getOperand(1), Str))
   return false;
 
 // If the second operand is not constant, just lower this to memchr since 
we
@@ -555,35 +543,26 @@
   Value *Args[3] = {
 CI->getOperand(1),
 CI->getOperand(2),
-ConstantInt::get(SLC.getIntPtrType(), StrLength+1)
+ConstantInt::get(SLC.getIntPtrType(), Str.size()+1)
   };
   return ReplaceCallWith(CI, new CallInst(SLC.get_memchr(), Args, 3,
   CI->getName(), CI));
 }
 
+// strchr can find the nul character.
+Str += '\0';
+
 // Get the character we're looking for
-int64_t CharValue = CSI->getSExtValue();
+char CharValue = CSI->getSExtValue();
 
-if (StrLength == 0) {
-  // If the length of the string is zero, and we are searching for zero,
-  // return the input pointer.
-  if (CharValue == 0)
-return ReplaceCallWith(CI, CI->getOperand(1));
-  // Otherwise, char wasn't found.
-  return ReplaceCallWith(CI, Constant::getNullValue(CI->getType()));
-}
-
 // Compute the offset
  

[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp

2007-04-07 Thread Nick Lewycky


Changes in directory llvm/lib/VMCore:

Dominators.cpp updated: 1.87 -> 1.88
---
Log message:

Don't crash when encountering a BasicBlock that hasn't been registered yet.


---
Diffs of the changes:  (+3 -2)

 Dominators.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.87 llvm/lib/VMCore/Dominators.cpp:1.88
--- llvm/lib/VMCore/Dominators.cpp:1.87 Sat Apr  7 13:23:27 2007
+++ llvm/lib/VMCore/Dominators.cpp  Sat Apr  7 20:02:12 2007
@@ -935,8 +935,9 @@
 for (df_iterator I = df_begin(Roots[i]),
E = df_end(Roots[i]); I != E; ++I) {
   BasicBlock *BB = *I;
-  if (!getNode(BB)->hasFather())
-getNode(BB)->assignDFSNumber(dfsnum);
+  ETNode *ETN = getNode(BB);
+  if (ETN && !ETN->hasFather())
+ETN->assignDFSNumber(dfsnum);
   }
   SlowQueries = 0;
   DFSInfoValid = true;



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


[llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp

2007-04-07 Thread Nick Lewycky


Changes in directory llvm/lib/Transforms/Utils:

LoopSimplify.cpp updated: 1.83 -> 1.84
---
Log message:

Remove DominatorSet usage from LoopSimplify. Patch from Owen Anderson.


---
Diffs of the changes:  (+54 -89)

 LoopSimplify.cpp |  143 ---
 1 files changed, 54 insertions(+), 89 deletions(-)


Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.83 
llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.84
--- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.83 Sat Apr  7 13:23:27 2007
+++ llvm/lib/Transforms/Utils/LoopSimplify.cpp  Sat Apr  7 20:04:30 2007
@@ -64,12 +64,10 @@
 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
   // We need loop information to identify the loops...
   AU.addRequired();
-  AU.addRequired();
   AU.addRequired();
   AU.addRequired();
 
   AU.addPreserved();
-  AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();
   AU.addPreserved();
@@ -313,8 +311,9 @@
 
   // Can we eliminate this phi node now?
   if (Value *V = PN->hasConstantValue(true)) {
-if (!isa(V) ||
-getAnalysis().dominates(cast(V), PN)) {
+Instruction *I = dyn_cast(V);
+if (!I || (I->getParent() != NewBB &&
+   getAnalysis().dominates(I, PN))) {
   PN->replaceAllUsesWith(V);
   if (AA) AA->deleteValue(PN);
   BB->getInstList().erase(PN);
@@ -542,10 +541,9 @@
 
   // Determine which blocks should stay in L and which should be moved out to
   // the Outer loop now.
-  DominatorSet &DS = getAnalysis();
   std::set BlocksInL;
   for (pred_iterator PI = pred_begin(Header), E = pred_end(Header); PI!=E; 
++PI)
-if (DS.dominates(Header, *PI))
+if (EF->dominates(Header, *PI))
   AddBlockAndPredsToSet(*PI, Header, BlocksInL);
 
 
@@ -674,8 +672,8 @@
 }
 
 /// UpdateDomInfoForRevectoredPreds - This method is used to update the four
-/// different kinds of dominator information (dominator sets, immediate
-/// dominators, dominator trees, and dominance frontiers) after a new block has
+/// different kinds of dominator information (immediate dominators,
+/// dominator trees, et-forest and dominance frontiers) after a new block has
 /// been added to the CFG.
 ///
 /// This only supports the case when an existing block (known as "NewBBSucc"),
@@ -693,33 +691,8 @@
  ++succ_begin(NewBB) == succ_end(NewBB) &&
  "NewBB should have a single successor!");
   BasicBlock *NewBBSucc = *succ_begin(NewBB);
-  DominatorSet &DS = getAnalysis();
-
-  // Update dominator information...  The blocks that dominate NewBB are the
-  // intersection of the dominators of predecessors, plus the block itself.
-  //
-  DominatorSet::DomSetType NewBBDomSet = DS.getDominators(PredBlocks[0]);
-  {
-unsigned i, e = PredBlocks.size();
-// It is possible for some preds to not be reachable, and thus have empty
-// dominator sets (all blocks must dom themselves, so no domset would
-// otherwise be empty).  If we see any of these, don't intersect with them,
-// as that would certainly leave the resultant set empty.
-for (i = 1; NewBBDomSet.empty(); ++i) {
-  assert(i != e && "Didn't find reachable pred?");
-  NewBBDomSet = DS.getDominators(PredBlocks[i]);
-}
-
-// Intersect the rest of the non-empty sets.
-for (; i != e; ++i) {
-  const DominatorSet::DomSetType &PredDS = DS.getDominators(PredBlocks[i]);
-  if (!PredDS.empty())
-set_intersect(NewBBDomSet, PredDS);
-}
-NewBBDomSet.insert(NewBB);  // All blocks dominate themselves.
-DS.addBasicBlock(NewBB, NewBBDomSet);
-  }
-
+  ETForest& ETF = getAnalysis();
+  
   // The newly inserted basic block will dominate existing basic blocks iff the
   // PredBlocks dominate all of the non-pred blocks.  If all predblocks 
dominate
   // the non-pred blocks, then they all must be the same block!
@@ -727,14 +700,16 @@
   bool NewBBDominatesNewBBSucc = true;
   {
 BasicBlock *OnePred = PredBlocks[0];
-unsigned i, e = PredBlocks.size();
-for (i = 1; !DS.isReachable(OnePred); ++i) {
+unsigned i = 1, e = PredBlocks.size();
+for (i = 1; !ETF.dominates(&OnePred->getParent()->getEntryBlock(), 
OnePred);
+ ++i) {
   assert(i != e && "Didn't find reachable pred?");
   OnePred = PredBlocks[i];
 }
 
 for (; i != e; ++i)
-  if (PredBlocks[i] != OnePred && DS.isReachable(PredBlocks[i])) {
+  if (PredBlocks[i] != OnePred &&
+  ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), 
OnePred)){
 NewBBDominatesNewBBSucc = false;
 break;
   }
@@ -742,7 +717,7 @@
 if (NewBBDominatesNewBBSucc)
   for (pred_iterator PI = pred_begin(NewBBSucc), E = pred_end(NewBBSucc);
PI != E; ++PI)
-if (*PI != NewBB && !DS.dominates(NewBBSucc, *PI)) {
+if (*PI != NewBB && !ETF.dominates(NewBBSucc