mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-30 16:17:05 +00:00 
			
		
		
		
	Disable the PPC CTR-Loops pass by default.
The pass itself works well, but the something in the Machine* infrastructure does not understand terminators which define registers. Without the ability to use the block-placement pass, etc. this causes performance regressions (and so is turned off by default). Turning off the analysis turns off the problems with the Machine* infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158206 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		| @@ -40,6 +40,10 @@ extern cl::opt<bool> DisablePPC64RS; | |||||||
|  |  | ||||||
| using namespace llvm; | using namespace llvm; | ||||||
|  |  | ||||||
|  | static cl:: | ||||||
|  | opt<bool> EnableCTRLoopAnal("enable-ppc-ctrloop-analysis", cl::Hidden, | ||||||
|  |             cl::desc("Enable analysis for CTR loops (experimental)")); | ||||||
|  |  | ||||||
| PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm) | PPCInstrInfo::PPCInstrInfo(PPCTargetMachine &tm) | ||||||
|   : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP), |   : PPCGenInstrInfo(PPC::ADJCALLSTACKDOWN, PPC::ADJCALLSTACKUP), | ||||||
|     TM(tm), RI(*TM.getSubtargetImpl(), *this) {} |     TM(tm), RI(*TM.getSubtargetImpl(), *this) {} | ||||||
| @@ -229,6 +233,8 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, | |||||||
|                LastInst->getOpcode() == PPC::BDNZ) { |                LastInst->getOpcode() == PPC::BDNZ) { | ||||||
|       if (!LastInst->getOperand(0).isMBB()) |       if (!LastInst->getOperand(0).isMBB()) | ||||||
|         return true; |         return true; | ||||||
|  |       if (!EnableCTRLoopAnal) | ||||||
|  |         return true; | ||||||
|       TBB = LastInst->getOperand(0).getMBB(); |       TBB = LastInst->getOperand(0).getMBB(); | ||||||
|       Cond.push_back(MachineOperand::CreateImm(1)); |       Cond.push_back(MachineOperand::CreateImm(1)); | ||||||
|       Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, |       Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, | ||||||
| @@ -238,6 +244,8 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, | |||||||
|                LastInst->getOpcode() == PPC::BDZ) { |                LastInst->getOpcode() == PPC::BDZ) { | ||||||
|       if (!LastInst->getOperand(0).isMBB()) |       if (!LastInst->getOperand(0).isMBB()) | ||||||
|         return true; |         return true; | ||||||
|  |       if (!EnableCTRLoopAnal) | ||||||
|  |         return true; | ||||||
|       TBB = LastInst->getOperand(0).getMBB(); |       TBB = LastInst->getOperand(0).getMBB(); | ||||||
|       Cond.push_back(MachineOperand::CreateImm(0)); |       Cond.push_back(MachineOperand::CreateImm(0)); | ||||||
|       Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, |       Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, | ||||||
| @@ -274,6 +282,8 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, | |||||||
|     if (!SecondLastInst->getOperand(0).isMBB() || |     if (!SecondLastInst->getOperand(0).isMBB() || | ||||||
|         !LastInst->getOperand(0).isMBB()) |         !LastInst->getOperand(0).isMBB()) | ||||||
|       return true; |       return true; | ||||||
|  |     if (!EnableCTRLoopAnal) | ||||||
|  |       return true; | ||||||
|     TBB = SecondLastInst->getOperand(0).getMBB(); |     TBB = SecondLastInst->getOperand(0).getMBB(); | ||||||
|     Cond.push_back(MachineOperand::CreateImm(1)); |     Cond.push_back(MachineOperand::CreateImm(1)); | ||||||
|     Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, |     Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, | ||||||
| @@ -286,6 +296,8 @@ bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, | |||||||
|     if (!SecondLastInst->getOperand(0).isMBB() || |     if (!SecondLastInst->getOperand(0).isMBB() || | ||||||
|         !LastInst->getOperand(0).isMBB()) |         !LastInst->getOperand(0).isMBB()) | ||||||
|       return true; |       return true; | ||||||
|  |     if (!EnableCTRLoopAnal) | ||||||
|  |       return true; | ||||||
|     TBB = SecondLastInst->getOperand(0).getMBB(); |     TBB = SecondLastInst->getOperand(0).getMBB(); | ||||||
|     Cond.push_back(MachineOperand::CreateImm(0)); |     Cond.push_back(MachineOperand::CreateImm(0)); | ||||||
|     Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, |     Cond.push_back(MachineOperand::CreateReg(isPPC64 ? PPC::CTR8 : PPC::CTR, | ||||||
|   | |||||||
| @@ -23,8 +23,8 @@ | |||||||
| using namespace llvm; | using namespace llvm; | ||||||
|  |  | ||||||
| static cl:: | static cl:: | ||||||
| opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden, | opt<bool> EnableCTRLoops("enable-ppc-ctrloops", cl::Hidden, | ||||||
|                         cl::desc("Disable CTR loops for PPC")); |                         cl::desc("Enable CTR loops for PPC")); | ||||||
|  |  | ||||||
| extern "C" void LLVMInitializePowerPCTarget() { | extern "C" void LLVMInitializePowerPCTarget() { | ||||||
|   // Register the targets |   // Register the targets | ||||||
| @@ -103,9 +103,10 @@ TargetPassConfig *PPCTargetMachine::createPassConfig(PassManagerBase &PM) { | |||||||
| } | } | ||||||
|  |  | ||||||
| bool PPCPassConfig::addPreRegAlloc() { | bool PPCPassConfig::addPreRegAlloc() { | ||||||
|   if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) { |   // FIXME: Once this can be enabled by default, this condition should read: | ||||||
|  |   // if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) | ||||||
|  |   if (EnableCTRLoops) | ||||||
|     PM->add(createPPCCTRLoops()); |     PM->add(createPPCCTRLoops()); | ||||||
|   } |  | ||||||
|  |  | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| ; ModuleID = 'bugpoint-reduced-simplified.bc' | ; 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 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" | target triple = "powerpc64-unknown-linux-gnu" | ||||||
| ; RUN: llc < %s -march=ppc64 | FileCheck %s | ; RUN: llc -enable-ppc-ctrloops < %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 } | %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 } | %union.v.0.48.90.114.120.138.144.150.156.162.168.174.180.210 = type { i64 } | ||||||
|   | |||||||
| @@ -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 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" | target triple = "powerpc64-unknown-freebsd10.0" | ||||||
| ; RUN: llc < %s -march=ppc64 | FileCheck %s | ; RUN: llc -enable-ppc-ctrloops -enable-ppc-ctrloop-analysis < %s -march=ppc64 | FileCheck %s | ||||||
|  |  | ||||||
| @a = common global i32 0, align 4 | @a = common global i32 0, align 4 | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user