[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp

Evan Cheng evan.cheng at apple.com
Wed Apr 4 00:05:12 PDT 2007



Changes in directory llvm/lib/CodeGen:

LiveIntervalAnalysis.cpp updated: 1.232 -> 1.233
---
Log message:

Trivially re-materializable instructions have spill weights that are half of what it would be otherwise.

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

 LiveIntervalAnalysis.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp
diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.233
--- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232	Mon Apr  2 13:49:18 2007
+++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp	Wed Apr  4 02:04:55 2007
@@ -164,13 +164,13 @@
             unsigned reg = rep(mop.getReg());
             mii->getOperand(i).setReg(reg);
 
-            // If the definition instruction is re-materializable, its spill
-            // weight is zero.
             LiveInterval &RegInt = getInterval(reg);
-            if (!RegInt.remat) {
-              RegInt.weight +=
-                (mop.isUse() + mop.isDef()) * pow(10.0F, (int)loopDepth);
-            }
+            float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);
+            // If the definition instruction is re-materializable, its spill
+            // weight is half of what it would have been normally.
+            if (RegInt.remat)
+              w /= 2;
+            RegInt.weight += w;
           }
         }
         ++mii;






More information about the llvm-commits mailing list