[llvm-branch-commits] [llvm-branch] r71137 - in /llvm/branches/Apple/Dib: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/StackSlotColoring.cpp test/CodeGen/X86/stack-color-with-reg.ll

Bill Wendling isanbard at gmail.com
Wed May 6 18:21:49 PDT 2009


Author: void
Date: Wed May  6 20:21:49 2009
New Revision: 71137

URL: http://llvm.org/viewvc/llvm-project?rev=71137&view=rev
Log:
Temporarily revert r71010. It was causing self-hosting failures.

Modified:
    llvm/branches/Apple/Dib/include/llvm/CodeGen/Passes.h
    llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp
    llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp
    llvm/branches/Apple/Dib/test/CodeGen/X86/stack-color-with-reg.ll

Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/Passes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/Passes.h?rev=71137&r1=71136&r2=71137&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/Passes.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/Passes.h Wed May  6 20:21:49 2009
@@ -191,7 +191,7 @@
   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);

Modified: llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp?rev=71137&r1=71136&r2=71137&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp Wed May  6 20:21:49 2009
@@ -193,7 +193,7 @@
 
   // 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));

Modified: llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp?rev=71137&r1=71136&r2=71137&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/StackSlotColoring.cpp Wed May  6 20:21:49 2009
@@ -37,22 +37,21 @@
              cl::desc("Suppress slot sharing during stack coloring"));
 
 static cl::opt<bool>
-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<int> 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 @@
 
   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<LiveStacks>();
@@ -140,8 +136,8 @@
 static RegisterPass<StackSlotColoring>
 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 @@
 StackSlotColoring::ColorSlotsWithFreeRegs(SmallVector<int, 16> &SlotMapping,
                                    SmallVector<SmallVector<int, 4>, 16> &RevMap,
                                    BitVector &SlotIsReg) {
-  if (!(ColorWithRegs || ColorWithRegsOpt) || !VRM->HasUnusedRegisters())
+  if (!ColorWithRegs || !VRM->HasUnusedRegisters())
     return false;
 
   bool Changed = false;
@@ -243,9 +239,7 @@
   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 @@
 bool StackSlotColoring::PropagateBackward(MachineBasicBlock::iterator MII,
                                           MachineBasicBlock *MBB,
                                           unsigned OldReg, unsigned NewReg) {
-  if (MII == MBB->begin())
-    return false;
-
   SmallVector<MachineOperand*, 4> Refs;
   while (--MII != MBB->begin()) {
     bool FoundDef = false;  // Not counting 2address def.
@@ -531,9 +522,6 @@
 bool StackSlotColoring::PropagateForward(MachineBasicBlock::iterator MII,
                                          MachineBasicBlock *MBB,
                                          unsigned OldReg, unsigned NewReg) {
-  if (MII == MBB->end())
-    return false;
-
   SmallVector<MachineOperand*, 4> Uses;
   while (++MII != MBB->end()) {
     bool FoundUse = false;

Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/stack-color-with-reg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/stack-color-with-reg.ll?rev=71137&r1=71136&r2=71137&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/stack-color-with-reg.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/stack-color-with-reg.ll Wed May  6 20:21:49 2009
@@ -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





More information about the llvm-branch-commits mailing list