Enable PPC CTR loop formation by default.
authorHal Finkel <hfinkel@anl.gov>
Fri, 8 Jun 2012 19:19:53 +0000 (19:19 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 8 Jun 2012 19:19:53 +0000 (19:19 +0000)
Thanks to Jakob's help, this now causes no new test suite failures!

Over the entire test suite, this gives an average 1% speedup. The largest speedups are:
SingleSource/Benchmarks/Misc/pi - 108%
SingleSource/Benchmarks/CoyoteBench/lpbench - 54%
MultiSource/Benchmarks/Prolangs-C/unix-smail/unix-smail - 50%
SingleSource/Benchmarks/Shootout/ary3 - 32%
SingleSource/Benchmarks/Shootout-C++/matrix - 30%

The largest slowdowns are:
MultiSource/Benchmarks/mediabench/gsm/toast/toast - -30%
MultiSource/Benchmarks/Prolangs-C/bison/mybison - -25%
MultiSource/Benchmarks/BitBench/uuencode/uuencode - -22%
MultiSource/Applications/d/make_dparser - -14%
SingleSource/Benchmarks/Shootout-C++/ary - -13%

In light of these slowdowns, additional profiling work is obviously needed!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158223 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.cpp
lib/Target/PowerPC/PPCTargetMachine.cpp
test/CodeGen/PowerPC/ctrloop-reg.ll
test/CodeGen/PowerPC/ctrloops.ll

index 8b868e69ecaa489d635831db7d410ce3843fff11..28b3bc1596e1e1e81268aee348a25f1db9c5e062 100644 (file)
@@ -41,8 +41,8 @@ extern cl::opt<bool> DisablePPC64RS;
 using namespace llvm;
 
 static cl::
-opt<bool> EnableCTRLoopAnal("enable-ppc-ctrloop-analysis", cl::Hidden,
-            cl::desc("Enable analysis for CTR loops (experimental)"));
+opt<bool> DisableCTRLoopAnal("disable-ppc-ctrloop-analysis", cl::Hidden,
+            cl::desc("Disable analysis for CTR loops"));
 
 PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm)
   : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP),
@@ -233,7 +233,7 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
                LastInst->getOpcode() == PPC::BDNZ) {
       if (!LastInst->getOperand(0).isMBB())
         return true;
-      if (!EnableCTRLoopAnal)
+      if (DisableCTRLoopAnal)
         return true;
       TBB = LastInst->getOperand(0).getMBB();
       Cond.push_back(MachineOperand::CreateImm(1));
@@ -244,7 +244,7 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
                LastInst->getOpcode() == PPC::BDZ) {
       if (!LastInst->getOperand(0).isMBB())
         return true;
-      if (!EnableCTRLoopAnal)
+      if (DisableCTRLoopAnal)
         return true;
       TBB = LastInst->getOperand(0).getMBB();
       Cond.push_back(MachineOperand::CreateImm(0));
@@ -282,7 +282,7 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
     if (!SecondLastInst->getOperand(0).isMBB() ||
         !LastInst->getOperand(0).isMBB())
       return true;
-    if (!EnableCTRLoopAnal)
+    if (DisableCTRLoopAnal)
       return true;
     TBB = SecondLastInst->getOperand(0).getMBB();
     Cond.push_back(MachineOperand::CreateImm(1));
@@ -296,7 +296,7 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
     if (!SecondLastInst->getOperand(0).isMBB() ||
         !LastInst->getOperand(0).isMBB())
       return true;
-    if (!EnableCTRLoopAnal)
+    if (DisableCTRLoopAnal)
       return true;
     TBB = SecondLastInst->getOperand(0).getMBB();
     Cond.push_back(MachineOperand::CreateImm(0));
index bcab83c5cf3c1daca94bff4d850cb0a6231ead23..b9c703e708dbf1b138c9cc224671a2a6660d2153 100644 (file)
@@ -23,8 +23,8 @@
 using namespace llvm;
 
 static cl::
-opt<bool> EnableCTRLoops("enable-ppc-ctrloops", cl::Hidden,
-                        cl::desc("Enable CTR loops for PPC"));
+opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden,
+                        cl::desc("Disable CTR loops for PPC"));
 
 extern "C" void LLVMInitializePowerPCTarget() {
   // Register the targets
@@ -103,9 +103,7 @@ TargetPassConfig *PPCTargetMachine::createPassConfig(PassManagerBase &PM) {
 }
 
 bool PPCPassConfig::addPreRegAlloc() {
-  // FIXME: Once this can be enabled by default, this condition should read:
-  // if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
-  if (EnableCTRLoops)
+  if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
     PM->add(createPPCCTRLoops());
 
   return false;
index 0746f66628d58fc00c1d28bf961c6bc23b250a36..874e5712bb994309724cea7b0fc3c927302708c8 100644 (file)
@@ -1,7 +1,7 @@
 ; ModuleID = 'bugpoint-reduced-simplified.bc'
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
-; RUN: llc -enable-ppc-ctrloops < %s -march=ppc64 | FileCheck %s
+; RUN: llc < %s -march=ppc64 | FileCheck %s
 
 %struct.ref_s.1.49.91.115.121.139.145.151.157.163.169.175.181.211 = type { %union.v.0.48.90.114.120.138.144.150.156.162.168.174.180.210, i16, i16 }
 %union.v.0.48.90.114.120.138.144.150.156.162.168.174.180.210 = type { i64 }
index ad55fa4a23e76df1d6a500d317f6a22db7b2e098..f7bd354ce8e100b3b12f6f46d74c8babca0779a5 100644 (file)
@@ -1,6 +1,6 @@
 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64"
 target triple = "powerpc64-unknown-freebsd10.0"
-; RUN: llc -enable-ppc-ctrloops -enable-ppc-ctrloop-analysis < %s -march=ppc64 | FileCheck %s
+; RUN: llc < %s -march=ppc64 | FileCheck %s
 
 @a = common global i32 0, align 4