Fix some kill info update bugs; add hidden option -disable-rematerialization to turn off remat for debugging.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41118 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-08-16 07:24:22 +00:00
parent af11dc00a0
commit bc165e436b
2 changed files with 16 additions and 1 deletions

View File

@ -36,6 +36,12 @@
#include <cmath>
using namespace llvm;
namespace {
// Hidden options for help debugging.
cl::opt<bool> DisableReMat("disable-rematerialization",
cl::init(false), cl::Hidden);
}
STATISTIC(numIntervals, "Number of original intervals");
STATISTIC(numIntervalsAfter, "Number of intervals after coalescing");
STATISTIC(numFolded , "Number of loads/stores folded into instructions");
@ -201,6 +207,9 @@ static bool isReDefinedByTwoAddr(MachineInstr *MI, unsigned Reg,
/// val# of the specified interval is re-materializable.
bool LiveIntervals::isReMaterializable(const LiveInterval &li, unsigned ValNum,
MachineInstr *MI) {
if (DisableReMat)
return false;
if (tii_->isTriviallyReMaterializable(MI))
return true;
@ -610,7 +619,7 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
DOUT << " Removing [" << Start << "," << End << "] from: ";
interval.print(DOUT, mri_); DOUT << "\n";
interval.removeRange(Start, End);
interval.addKillForValNum(0, Start-1); // odd # means phi node
interval.addKillForValNum(0, Start+1); // odd # means phi node
DOUT << " RESULT: "; interval.print(DOUT, mri_);
// Replace the interval with one of a NEW value number. Note that this

View File

@ -683,6 +683,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
RHSValNoAssignments[0] = RHSValID;
if (RHSVal0DefinedFromLHS != -1) {
int LHSValId = LHSValNoAssignments[RHSVal0DefinedFromLHS];
unsigned DefIdx = RHS.getDefForValNum(0);
LiveInterval::removeKill(ValueNumberInfo[LHSValId], DefIdx);
LHS.addKills(ValueNumberInfo[LHSValId], RHS.getKillsForValNum(0));
}
} else {
@ -797,6 +799,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
if (LHSValId == -1)
continue;
unsigned RHSValId = RHSValNoAssignments[i];
unsigned DefIdx = RHS.getDefForValNum(i);
LiveInterval::removeKill(ValueNumberInfo[RHSValId], DefIdx);
LHS.addKills(ValueNumberInfo[RHSValId], RHS.getKillsForValNum(i));
}
for (unsigned i = 0, e = LHSValsDefinedFromRHS.size(); i != e; ++i) {
@ -804,6 +808,8 @@ bool SimpleRegisterCoalescing::JoinIntervals(LiveInterval &LHS, LiveInterval &RH
if (RHSValId == -1)
continue;
unsigned LHSValId = LHSValNoAssignments[i];
unsigned DefIdx = LHS.getDefForValNum(i);
LiveInterval::removeKill(ValueNumberInfo[LHSValId], DefIdx);
RHS.addKills(ValueNumberInfo[LHSValId], LHS.getKillsForValNum(i));
}