[llvm-commits] [llvm] r52572 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/X86/2006-05-11-InstrSched.ll test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll test/CodeGen/X86/2008-03-18-CoalescerBug.ll
Evan Cheng
evan.cheng at apple.com
Fri Jun 20 23:45:55 PDT 2008
Author: evancheng
Date: Sat Jun 21 01:45:54 2008
New Revision: 52572
URL: http://llvm.org/viewvc/llvm-project?rev=52572&view=rev
Log:
Undo spill weight tweak. Need to investigate the performance regressions.
Modified:
llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
llvm/trunk/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll
llvm/trunk/test/CodeGen/X86/2008-03-18-CoalescerBug.ll
Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Jun 21 01:45:54 2008
@@ -121,12 +121,8 @@
return getBaseIndex(index) + InstrSlots::STORE;
}
- static float getSpillWeight(bool isDef, bool isUse, bool isMem,
- unsigned loopDepth) {
- float Weight = isDef;
- if (isUse)
- Weight += isMem ? 1.2f : 1.0f;
- return Weight * powf(10.0F, (float)loopDepth);
+ static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
+ return (isDef + isUse) * powf(10.0F, (float)loopDepth);
}
typedef Reg2IntervalMap::iterator iterator;
Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sat Jun 21 01:45:54 2008
@@ -979,7 +979,6 @@
unsigned loopDepth = loopInfo->getLoopDepth(MBB);
bool CanFold = false;
RestartInstruction:
- bool isMem = MI->getDesc().mayLoad() || MI->getDesc().mayStore();
for (unsigned i = 0; i != MI->getNumOperands(); ++i) {
MachineOperand& mop = MI->getOperand(i);
if (!mop.isRegister())
@@ -1047,7 +1046,7 @@
}
// Update stack slot spill weight if we are splitting.
- float Weight = getSpillWeight(HasDef, HasUse, isMem, loopDepth);
+ float Weight = getSpillWeight(HasDef, HasUse, loopDepth);
if (!TrySplit)
SSWeight += Weight;
@@ -1240,7 +1239,6 @@
bool MIHasUse = rwi.HasUse;
bool MIHasDef = rwi.HasDef;
MachineInstr *MI = rwi.MI;
- bool isMem = MI->getDesc().mayLoad() || MI->getDesc().mayStore();
// If MI def and/or use the same register multiple times, then there
// are multiple entries.
unsigned NumUses = MIHasUse;
@@ -1388,7 +1386,7 @@
// Update spill weight.
unsigned loopDepth = loopInfo->getLoopDepth(MBB);
- nI.weight += getSpillWeight(HasDef, HasUse, isMem, loopDepth);
+ nI.weight += getSpillWeight(HasDef, HasUse, loopDepth);
}
if (NewVReg && TrySplit && AllCanFold) {
@@ -1630,7 +1628,6 @@
LiveInterval &nI = getOrCreateInterval(VReg);
bool isReMat = vrm.isReMaterialized(VReg);
MachineInstr *MI = getInstructionFromIndex(index);
- bool isMem = MI->getDesc().mayLoad() || MI->getDesc().mayStore();
bool CanFold = false;
bool FoundUse = false;
Ops.clear();
@@ -1683,7 +1680,7 @@
// Update spill slot weight.
if (!isReMat)
- SSWeight += getSpillWeight(true, false, isMem, loopDepth);
+ SSWeight += getSpillWeight(true, false, loopDepth);
}
Id = SpillMBBs.find_next(Id);
}
@@ -1703,7 +1700,6 @@
LiveInterval &nI = getOrCreateInterval(VReg);
bool isReMat = vrm.isReMaterialized(VReg);
MachineInstr *MI = getInstructionFromIndex(index);
- bool isMem = MI->getDesc().mayLoad() || MI->getDesc().mayStore();
bool CanFold = false;
Ops.clear();
if (restores[i].canFold) {
@@ -1757,7 +1753,7 @@
// Update spill slot weight.
if (!isReMat)
- SSWeight += getSpillWeight(false, true, isMem, loopDepth);
+ SSWeight += getSpillWeight(false, true, loopDepth);
}
Id = RestoreMBBs.find_next(Id);
}
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Sat Jun 21 01:45:54 2008
@@ -2145,7 +2145,6 @@
mii = mbbi->erase(mii);
++numPeep;
} else if (!isMove || !TurnCopyIntoImpDef(mii, mbb, DstReg, SrcReg)) {
- bool isMem = mii->getDesc().mayLoad() || mii->getDesc().mayStore();
SmallSet<unsigned, 4> UniqueUses;
for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {
const MachineOperand &mop = mii->getOperand(i);
@@ -2158,7 +2157,7 @@
continue;
LiveInterval &RegInt = li_->getInterval(reg);
RegInt.weight +=
- li_->getSpillWeight(mop.isDef(), mop.isUse(), isMem, loopDepth);
+ li_->getSpillWeight(mop.isDef(), mop.isUse(), loopDepth);
UniqueUses.insert(reg);
}
}
Modified: llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Sat Jun 21 01:45:54 2008
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats -realign-stack=0 |&\
-; RUN: grep {asm-printer} | grep 31
+; RUN: grep {asm-printer} | grep 32
target datalayout = "e-p:32:32"
define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) nounwind {
Modified: llvm/trunk/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll Sat Jun 21 01:45:54 2008
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | grep movl | count 4
+; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | grep movl | count 2
%struct.double_int = type { i64, i64 }
%struct.tree_common = type <{ i8, [3 x i8] }>
Modified: llvm/trunk/test/CodeGen/X86/2008-03-18-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-03-18-CoalescerBug.ll?rev=52572&r1=52571&r2=52572&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-03-18-CoalescerBug.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-03-18-CoalescerBug.ll Sat Jun 21 01:45:54 2008
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+sse2 -disable-fp-elim | grep movss | count 1
-; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+sse2 -disable-fp-elim -stats |& grep {Number of re-materialization} | grep 2
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -mattr=+sse2 -disable-fp-elim -stats |& grep {Number of re-materialization} | grep 1
%struct..0objc_object = type opaque
%struct.OhBoy = type { }
More information about the llvm-commits
mailing list