From d0c1f9c932e9da29ea4c6e9a863f1567c6e61477 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 7 May 2009 01:27:25 +0000 Subject: [PATCH] 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 --- include/llvm/CodeGen/Passes.h | 2 +- lib/CodeGen/LLVMTargetMachine.cpp | 2 +- lib/CodeGen/StackSlotColoring.cpp | 30 +++++++---------------- test/CodeGen/X86/2009-03-16-SpillerBug.ll | 1 + test/CodeGen/X86/stack-color-with-reg.ll | 1 + 5 files changed, 13 insertions(+), 23 deletions(-) diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index faf98319525..e9d26cf4c23 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -191,7 +191,7 @@ namespace llvm { FunctionPass *createMachineSinkingPass(); /// createStackSlotColoringPass - This pass performs stack slot coloring. - FunctionPass *createStackSlotColoringPass(bool); + FunctionPass *createStackSlotColoringPass(); /// createStackProtectorPass - This pass adds stack protectors to functions. FunctionPass *createStackProtectorPass(const TargetLowering *tli); diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index 5f19660a268..faaa41b68b6 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -193,7 +193,7 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM, // Perform stack slot coloring. if (OptLevel != CodeGenOpt::None) - PM.add(createStackSlotColoringPass(OptLevel >= CodeGenOpt::Aggressive)); + PM.add(createStackSlotColoringPass()); if (PrintMachineCode) // Print the register-allocated code PM.add(createMachineFunctionPrinterPass(cerr)); diff --git a/lib/CodeGen/StackSlotColoring.cpp b/lib/CodeGen/StackSlotColoring.cpp index 18fe59f3b72..0d9b85af8e7 100644 --- a/lib/CodeGen/StackSlotColoring.cpp +++ b/lib/CodeGen/StackSlotColoring.cpp @@ -37,22 +37,21 @@ DisableSharing("no-stack-slot-sharing", cl::desc("Suppress slot sharing during stack coloring")); static cl::opt -ColorWithRegsOpt("color-ss-with-regs", - cl::init(false), cl::Hidden, - cl::desc("Color stack slots with free registers")); +ColorWithRegs("color-ss-with-regs", + cl::init(false), cl::Hidden, + cl::desc("Color stack slots with free registers")); static cl::opt DCELimit("ssc-dce-limit", cl::init(-1), cl::Hidden); STATISTIC(NumEliminated, "Number of stack slots eliminated due to coloring"); 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(NumDead, "Number of trivially dead stack accesses eliminated"); namespace { class VISIBILITY_HIDDEN StackSlotColoring : public MachineFunctionPass { - bool ColorWithRegs; LiveStacks* LS; VirtRegMap* VRM; MachineFrameInfo *MFI; @@ -90,10 +89,7 @@ namespace { public: static char ID; // Pass identification - StackSlotColoring() : - MachineFunctionPass(&ID), ColorWithRegs(false), NextColor(-1) {} - StackSlotColoring(bool RegColor) : - MachineFunctionPass(&ID), ColorWithRegs(RegColor), NextColor(-1) {} + StackSlotColoring() : MachineFunctionPass(&ID), NextColor(-1) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); @@ -140,8 +136,8 @@ char StackSlotColoring::ID = 0; static RegisterPass X("stack-slot-coloring", "Stack Slot Coloring"); -FunctionPass *llvm::createStackSlotColoringPass(bool RegColor) { - return new StackSlotColoring(RegColor); +FunctionPass *llvm::createStackSlotColoringPass() { + return new StackSlotColoring(); } namespace { @@ -235,7 +231,7 @@ bool StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector &SlotMapping, SmallVector, 16> &RevMap, BitVector &SlotIsReg) { - if (!(ColorWithRegs || ColorWithRegsOpt) || !VRM->HasUnusedRegisters()) + if (!ColorWithRegs || !VRM->HasUnusedRegisters()) return false; bool Changed = false; @@ -243,9 +239,7 @@ StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector &SlotMapping, for (unsigned i = 0, e = SSIntervals.size(); i != e; ++i) { LiveInterval *li = SSIntervals[i]; int SS = li->getStackSlotIndex(); - if (!UsedColors[SS] || li->weight < 20) - // If the weight is < 20, i.e. two references in a loop with depth 1, - // don't bother with it. + if (!UsedColors[SS]) continue; // 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, MachineBasicBlock *MBB, unsigned OldReg, unsigned NewReg) { - if (MII == MBB->begin()) - return false; - SmallVector Refs; while (--MII != MBB->begin()) { bool FoundDef = false; // Not counting 2address def. @@ -531,9 +522,6 @@ bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII, bool StackSlotColoring::PropagateForward(MachineBasicBlock::iterator MII, MachineBasicBlock *MBB, unsigned OldReg, unsigned NewReg) { - if (MII == MBB->end()) - return false; - SmallVector Uses; while (++MII != MBB->end()) { bool FoundUse = false; diff --git a/test/CodeGen/X86/2009-03-16-SpillerBug.ll b/test/CodeGen/X86/2009-03-16-SpillerBug.ll index 09782a26fec..e9581f2d27c 100644 --- a/test/CodeGen/X86/2009-03-16-SpillerBug.ll +++ b/test/CodeGen/X86/2009-03-16-SpillerBug.ll @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -stats |& grep virtregrewriter | not grep {stores unfolded} +; XFAIL: * ; rdar://6682365 ; Do not clobber a register if another spill slot is available in it and it's marked "do not clobber". diff --git a/test/CodeGen/X86/stack-color-with-reg.ll b/test/CodeGen/X86/stack-color-with-reg.ll index f47e17abf8a..ef4f95584bc 100644 --- a/test/CodeGen/X86/stack-color-with-reg.ll +++ b/test/CodeGen/X86/stack-color-with-reg.ll @@ -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: grep stackcoloring %t | grep "loads eliminated" ; RUN: grep stackcoloring %t | grep "stores eliminated" +; XFAIL: * type { [62 x %struct.Bitvec*] } ; type %0 type { i8* } ; type %1 -- 2.34.1