diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-12-06 00:01:56 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-12-06 00:01:56 +0000 |
commit | 5ef3a04b542c4e585276768fa9ca2af698ef5c87 (patch) | |
tree | 6b72163b7ae2b198f8295130ebab1761ada9d43b /lib/CodeGen/SimpleRegisterCoalescing.cpp | |
parent | bdcb726fcad1e3fddc70847a2b91d4d4f9396938 (diff) |
Fix for PR1831: if all defs of an interval are re-materializable, then it's a preferred spill candiate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44644 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SimpleRegisterCoalescing.cpp')
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 3d2669becd..6eec5ab885 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -1485,6 +1485,20 @@ bool SimpleRegisterCoalescing::runOnMachineFunction(MachineFunction &fn) { // it and hope it will be easier to allocate for this li. if (isZeroLengthInterval(&LI)) LI.weight = HUGE_VALF; + else { + bool isLoad = false; + if (li_->isReMaterializable(LI, isLoad)) { + // If all of the definitions of the interval are re-materializable, + // it is a preferred candidate for spilling. If non of the defs are + // loads, then it's potentially very cheap to re-materialize. + // FIXME: this gets much more complicated once we support non-trivial + // re-materialization. + if (isLoad) + LI.weight *= 0.9F; + else + LI.weight *= 0.5F; + } + } // Slightly prefer live interval that has been assigned a preferred reg. if (LI.preference) |