[llvm-commits] [llvm] r41167 - /llvm/trunk/include/llvm/Analysis/Dominators.h

2007-08-18 Thread Nick Lewycky
Author: nicholas
Date: Sat Aug 18 09:46:55 2007
New Revision: 41167

URL: http://llvm.org/viewvc/llvm-project?rev=41167&view=rev
Log:
Simplify.

Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h

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

==
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Sat Aug 18 09:46:55 2007
@@ -379,8 +379,7 @@
   void removeBlock(BasicBlock *BB) {
 assert(find(BB) != end() && "Block is not in DominanceFrontier!");
 for (iterator I = begin(), E = end(); I != E; ++I)
-  if (I->second.count(BB))
-I->second.erase(BB);
+  I->second.erase(BB);
 Frontiers.erase(BB);
   }
 


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


[llvm-commits] [llvm] r41168 - /llvm/trunk/lib/Transforms/Scalar/LICM.cpp

2007-08-18 Thread Nick Lewycky
Author: nicholas
Date: Sat Aug 18 10:08:56 2007
New Revision: 41168

URL: http://llvm.org/viewvc/llvm-project?rev=41168&view=rev
Log:
Typo.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Sat Aug 18 10:08:56 2007
@@ -265,7 +265,7 @@
   //
   // Traverse the body of the loop in depth first order on the dominator tree 
so
   // that we are guaranteed to see definitions before we see uses.  This allows
-  // us to sink instructions in one pass, without iteration.  AFter sinking
+  // us to sink instructions in one pass, without iteration.  After sinking
   // instructions, we perform another pass to hoist them out of the loop.
   //
   SinkRegion(DT->getNode(L->getHeader()));


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


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

2007-08-18 Thread Nick Lewycky
Author: nicholas
Date: Sat Aug 18 18:21:28 2007
New Revision: 41170

URL: http://llvm.org/viewvc/llvm-project?rev=41170&view=rev
Log:
Oops, remove assert that wasn't meant to be committed.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Aug 18 
18:21:28 2007
@@ -712,8 +712,6 @@
 }
 
 if (J != E && J->To == n) {
-  assert(J->Subtree->dominates(Subtree));
-
   edge.LV = static_cast(J->LV & R);
   assert(validPredicate(edge.LV) && "Invalid union of lattice 
values.");
 


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


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

2007-08-18 Thread Nick Lewycky
Author: nicholas
Date: Sat Aug 18 18:18:03 2007
New Revision: 41169

URL: http://llvm.org/viewvc/llvm-project?rev=41169&view=rev
Log:
Never insert duplicate edges.

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

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

==
--- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Sat Aug 18 
18:18:03 2007
@@ -711,23 +711,27 @@
   ++J;
 }
 
-if (J != E && J->To == n && J->Subtree->dominates(Subtree)) {
+if (J != E && J->To == n) {
+  assert(J->Subtree->dominates(Subtree));
+
   edge.LV = static_cast(J->LV & R);
   assert(validPredicate(edge.LV) && "Invalid union of lattice 
values.");
-  if (edge.LV != J->LV) {
 
-// We have to tighten any edge beneath our update.
-for (iterator K = I; K->To == n; --K) {
-  if (K->Subtree->DominatedBy(Subtree)) {
-LatticeVal LV = static_cast(K->LV & edge.LV);
-assert(validPredicate(LV) && "Invalid union of lattice 
values");
-K->LV = LV;
-  }
-  if (K == B) break;
+  if (edge.LV == J->LV)
+return; // This update adds nothing new.
+   }
+
+if (I != B) {
+  // We also have to tighten any edge beneath our update.
+  for (iterator K = I - 1; K->To == n; --K) {
+if (K->Subtree->DominatedBy(Subtree)) {
+  LatticeVal LV = static_cast(K->LV & edge.LV);
+  assert(validPredicate(LV) && "Invalid union of lattice values");
+  K->LV = LV;
 }
-
+if (K == B) break;
   }
-}
+   }
 
 // Insert new edge at Subtree if it isn't already there.
 if (I == E || I->To != n || Subtree != I->Subtree)


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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Duncan Sands
Hi Reid,

> +  bool extend = false;

it looks like extend is never assigned another value.

Ciao,

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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Duncan Sands
Hi Reid,

> -  Attrs.push_back(ParamAttrsWithIndex::get(ArgTypes.size(), Attributes));
> +  Client.addAttributes(ArgTypes.size(), Attributes);

all users of addAttributes seem to be adding a new attribute at
the back.  Given this, your implementation of addAttributes looks
inefficient.  Also, does it work correctly? - addAttributes doesn't
add the attribute at all if there are no existing attributes for that
index, which seems to be exactly the case for every use of it!

Ciao,

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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Duncan Sands
Hi Reid,

in ConvertFunctionType:

> +  PAL = 0;

so there is no need for callers to set PAL = 0 before
calling ConvertFunctionType, as they all do right now.
For that matter, it's not clear that this assignment is
needed since it looks like PAL is always assigned
elsewhere before ConvertFunctionType returns (you could
argue that initializing it to zero is defensive programming,
defending against future changes).

Ciao,

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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Reid Spencer
On Thu, 2007-08-16 at 16:27 +0200, Duncan Sands wrote:
> Hi Reid,
> 
> > +  bool extend = false;
> 
> it looks like extend is never assigned another value.

This doesn't exist in the current patch.

> 
> Ciao,
> 
> Duncan.

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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Reid Spencer
On Thu, 2007-08-16 at 16:32 +0200, Duncan Sands wrote:
> Hi Reid,
> 
> in ConvertFunctionType:
> 
> > +  PAL = 0;
> 
> so there is no need for callers to set PAL = 0 before
> calling ConvertFunctionType, as they all do right now.
> For that matter, it's not clear that this assignment is
> needed since it looks like PAL is always assigned
> elsewhere before ConvertFunctionType returns (you could
> argue that initializing it to zero is defensive programming,
> defending against future changes).

That is exactly the reason why it is initialized.

> 
> Ciao,
> 
> Duncan.

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


Re: [llvm-commits] PR1146 patch for llvm-gcc-4.0

2007-08-18 Thread Reid Spencer
On Thu, 2007-08-16 at 17:56 +0200, Duncan Sands wrote:
> Hi Reid,
> 
> > -  Attrs.push_back(ParamAttrsWithIndex::get(ArgTypes.size(), 
> > Attributes));
> > +  Client.addAttributes(ArgTypes.size(), Attributes);
> 
> all users of addAttributes seem to be adding a new attribute at
> the back.  Given this, your implementation of addAttributes looks
> inefficient.  Also, does it work correctly? - addAttributes doesn't
> add the attribute at all if there are no existing attributes for that
> index, which seems to be exactly the case for every use of it!

Again, this doesn't exist in the current patch. Please see the patch
currently attached to PR1146 for the latest details. Thanks for taking a
look at this though, I appreciate it.

Reid.

> 
> Ciao,
> 
> Duncan.
>  

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