Fix a pasto. Also simplify for Bill's benefit.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 22 Sep 2009 01:48:19 +0000 (01:48 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 22 Sep 2009 01:48:19 +0000 (01:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82505 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SimpleRegisterCoalescing.cpp
test/CodeGen/ARM/2008-11-19-ScavengerAssert.ll
test/CodeGen/X86/2008-02-22-ReMatBug.ll

index 068dcda93b5fe8a6c321ff6ecdebe4c61916bfaa..22b62c3603797a8bfea33ffd18874eb1116e0e44 100644 (file)
@@ -2571,17 +2571,19 @@ void SimpleRegisterCoalescing::CalculateSpillWeights() {
           continue;
 
         bool HasDef = mopi.isDef();
-        bool HasUse = mopi.isUse();
+        bool HasUse = !HasDef;
         for (unsigned j = i+1; j != e; ++j) {
           const MachineOperand &mopj = MI->getOperand(j);
           if (!mopj.isReg() || mopj.getReg() != Reg)
             continue;
           HasDef |= mopj.isDef();
           HasUse |= mopj.isUse();
+          if (HasDef && HasUse)
+            break;
         }
 
         LiveInterval &RegInt = li_->getInterval(Reg);
-        float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth+1);
+        float Weight = li_->getSpillWeight(HasDef, HasUse, loopDepth);
         if (HasDef && isExit) {
           // Looks like this is a loop count variable update.
           MachineInstrIndex DefIdx =
index 221a168cba87fec022320d6e0c43228de98cd25c..3291856f18c04641a6c4d75c8d0606abc68688ff 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 161
+; RUN: llc < %s -mtriple=arm-apple-darwin9 -stats |& grep asm-printer | grep 162
 
        %"struct.Adv5::Ekin<3>" = type <{ i8 }>
        %"struct.Adv5::X::Energyflux<3>" = type { double }
index a91ac27f98ddd01c1e9eeac09b4d48d9fc83b8bf..8d6bb0df1f6d07a64cd31460a1a8b7c6164d3db6 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 2
+; RUN: llc < %s -march=x86 -stats |& grep {Number of re-materialization} | grep 3
 ; rdar://5761454
 
        %struct.quad_struct = type { i32, i32, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct*, %struct.quad_struct* }