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

Chris Lattner lattner at cs.uiuc.edu
Tue Apr 19 12:16:35 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

SCCP.cpp updated: 1.121 -> 1.122
---
Log message:

Wrap some long lines.
Make IPSCCP strip off dead constant exprs that are using functions, making
them appear as though their address is taken.  This allows us to propagate
some more pool descriptors, lowering the overhead of pool alloc.


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

 SCCP.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.121 llvm/lib/Transforms/Scalar/SCCP.cpp:1.122
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.121	Mon Mar 14 22:54:21 2005
+++ llvm/lib/Transforms/Scalar/SCCP.cpp	Tue Apr 19 14:16:19 2005
@@ -1141,6 +1141,9 @@
 
 
 static bool AddressIsTaken(GlobalValue *GV) {
+  // Delete any dead constantexpr klingons.
+  GV->removeDeadConstantUsers();
+
   for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end();
        UI != E; ++UI)
     if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
@@ -1173,7 +1176,8 @@
     if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
       if (!F->isExternal())
         Solver.MarkBlockExecutable(F->begin());
-      for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
+      for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
+           AI != E; ++AI)
         Values[AI].markOverdefined();
     } else {
       Solver.AddTrackedFunction(F);
@@ -1182,7 +1186,8 @@
   // Loop over global variables.  We inform the solver about any internal global
   // variables that do not have their 'addresses taken'.  If they don't have
   // their addresses taken, we can propagate constants through them.
-  for (Module::global_iterator G = M.global_begin(), E = M.global_end(); G != E; ++G)
+  for (Module::global_iterator G = M.global_begin(), E = M.global_end();
+       G != E; ++G)
     if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G))
       Solver.TrackValueOfGlobalVariable(G);
 
@@ -1204,7 +1209,8 @@
   //
   std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks();
   for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
-    for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
+    for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
+         AI != E; ++AI)
       if (!AI->use_empty()) {
         LatticeVal &IV = Values[AI];
         if (IV.isConstant() || IV.isUndefined()) {






More information about the llvm-commits mailing list