Temporarily revert r71010. It was causing massive failures during self-hosting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2009-05-07 01:27:25 +00:00
parent 116b27444a
commit d0c1f9c932
5 changed files with 13 additions and 23 deletions

View File

@ -191,7 +191,7 @@ namespace llvm {
FunctionPass *createMachineSinkingPass(); FunctionPass *createMachineSinkingPass();
/// createStackSlotColoringPass - This pass performs stack slot coloring. /// createStackSlotColoringPass - This pass performs stack slot coloring.
FunctionPass *createStackSlotColoringPass(bool); FunctionPass *createStackSlotColoringPass();
/// createStackProtectorPass - This pass adds stack protectors to functions. /// createStackProtectorPass - This pass adds stack protectors to functions.
FunctionPass *createStackProtectorPass(const TargetLowering *tli); FunctionPass *createStackProtectorPass(const TargetLowering *tli);

View File

@ -193,7 +193,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
// Perform stack slot coloring. // Perform stack slot coloring.
if (OptLevel != CodeGenOpt::None) if (OptLevel != CodeGenOpt::None)
PM.add(createStackSlotColoringPass(OptLevel >= CodeGenOpt::Aggressive)); PM.add(createStackSlotColoringPass());
if (PrintMachineCode) // Print the register-allocated code if (PrintMachineCode) // Print the register-allocated code
PM.add(createMachineFunctionPrinterPass(cerr)); PM.add(createMachineFunctionPrinterPass(cerr));

View File

@ -37,22 +37,21 @@ DisableSharing("no-stack-slot-sharing",
cl::desc("Suppress slot sharing during stack coloring")); cl::desc("Suppress slot sharing during stack coloring"));
static cl::opt<bool> static cl::opt<bool>
ColorWithRegsOpt("color-ss-with-regs", ColorWithRegs("color-ss-with-regs",
cl::init(false), cl::Hidden, cl::init(false), cl::Hidden,
cl::desc("Color stack slots with free registers")); cl::desc("Color stack slots with free registers"));
static cl::opt<int> DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden); static cl::opt<int> DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden);
STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring"); STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring");
STATISTIC(NumRegRepl, "Number of stack slot refs replaced with reg refs"); STATISTIC(NumRegRepl, "Number of stack slot refs replaced with reg refs");
STATISTIC(NumLoadElim, "Number of loads eliminated"); STATISTIC(NumLoadElim, "Number of load eliminated");
STATISTIC(NumStoreElim, "Number of stores eliminated"); STATISTIC(NumStoreElim, "Number of stores eliminated");
STATISTIC(NumDead, "Number of trivially dead stack accesses eliminated"); STATISTIC(NumDead, "Number of trivially dead stack accesses eliminated");
namespace { namespace {
class VISIBILITY_HIDDEN StackSlotColoring : public MachineFunctionPass { class VISIBILITY_HIDDEN StackSlotColoring : public MachineFunctionPass {
bool ColorWithRegs;
LiveStacks* LS; LiveStacks* LS;
VirtRegMap* VRM; VirtRegMap* VRM;
MachineFrameInfo *MFI; MachineFrameInfo *MFI;
@ -90,10 +89,7 @@ namespace {
public: public:
static char ID; // Pass identification static char ID; // Pass identification
StackSlotColoring() : StackSlotColoring() : MachineFunctionPass(&ID), NextColor(-1) {}
MachineFunctionPass(&ID), ColorWithRegs(false), NextColor(-1) {}
StackSlotColoring(bool RegColor) :
MachineFunctionPass(&ID), ColorWithRegs(RegColor), NextColor(-1) {}
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<LiveStacks>(); AU.addRequired<LiveStacks>();
@ -140,8 +136,8 @@ char StackSlotColoring::ID = 0;
static RegisterPass<StackSlotColoring> static RegisterPass<StackSlotColoring>
X("stack-slot-coloring", "Stack Slot Coloring"); X("stack-slot-coloring", "Stack Slot Coloring");
FunctionPass *llvm::createStackSlotColoringPass(bool RegColor) { FunctionPass *llvm::createStackSlotColoringPass() {
return new StackSlotColoring(RegColor); return new StackSlotColoring();
} }
namespace { namespace {
@ -235,7 +231,7 @@ bool
StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping, StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
SmallVector<SmallVector<int, 4>, 16> &RevMap, SmallVector<SmallVector<int, 4>, 16> &RevMap,
BitVector &SlotIsReg) { BitVector &SlotIsReg) {
if (!(ColorWithRegs || ColorWithRegsOpt) || !VRM->HasUnusedRegisters()) if (!ColorWithRegs || !VRM->HasUnusedRegisters())
return false; return false;
bool Changed = false; bool Changed = false;
@ -243,9 +239,7 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) {
LiveInterval *li = SSIntervals[i]; LiveInterval *li = SSIntervals[i];
int SS = li->getStackSlotIndex(); int SS = li->getStackSlotIndex();
if (!UsedColors[SS] || li->weight < 20) if (!UsedColors[SS])
// If the weight is < 20, i.e. two references in a loop with depth 1,
// don't bother with it.
continue; continue;
// These slots allow to share the same registers. // These slots allow to share the same registers.
@ -478,9 +472,6 @@ void StackSlotColoring::RewriteInstruction(MachineInstr *MI, int OldFI,
bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII, bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII,
MachineBasicBlock *MBB, MachineBasicBlock *MBB,
unsigned OldReg, unsigned NewReg) { unsigned OldReg, unsigned NewReg) {
if (MII == MBB->begin())
return false;
SmallVector<MachineOperand*, 4> Refs; SmallVector<MachineOperand*, 4> Refs;
while (--MII != MBB->begin()) { while (--MII != MBB->begin()) {
bool FoundDef = false; // Not counting 2address def. bool FoundDef = false; // Not counting 2address def.
@ -531,9 +522,6 @@ bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII,
bool StackSlotColoring::PropagateForward(MachineBasicBlock::iterator MII, bool StackSlotColoring::PropagateForward(MachineBasicBlock::iterator MII,
MachineBasicBlock *MBB, MachineBasicBlock *MBB,
unsigned OldReg, unsigned NewReg) { unsigned OldReg, unsigned NewReg) {
if (MII == MBB->end())
return false;
SmallVector<MachineOperand*, 4> Uses; SmallVector<MachineOperand*, 4> Uses;
while (++MII != MBB->end()) { while (++MII != MBB->end()) {
bool FoundUse = false; bool FoundUse = false;

View File

@ -1,4 +1,5 @@
; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -stats |& grep virtregrewriter | not grep {stores unfolded} ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -stats |& grep virtregrewriter | not grep {stores unfolded}
; XFAIL: *
; rdar://6682365 ; rdar://6682365
; Do not clobber a register if another spill slot is available in it and it's marked "do not clobber". ; Do not clobber a register if another spill slot is available in it and it's marked "do not clobber".

View File

@ -1,6 +1,7 @@
; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin10 -relocation-model=pic -disable-fp-elim -O3 -stats -info-output-file - > %t ; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin10 -relocation-model=pic -disable-fp-elim -O3 -stats -info-output-file - > %t
; RUN: grep stackcoloring %t | grep "loads eliminated" ; RUN: grep stackcoloring %t | grep "loads eliminated"
; RUN: grep stackcoloring %t | grep "stores eliminated" ; RUN: grep stackcoloring %t | grep "stores eliminated"
; XFAIL: *
type { [62 x %struct.Bitvec*] } ; type %0 type { [62 x %struct.Bitvec*] } ; type %0
type { i8* } ; type %1 type { i8* } ; type %1