AMDGPU: Make skip threshold an option

llvm-svn: 276680
This commit is contained in:
Matt Arsenault 2016-07-25 19:48:29 +00:00
parent e047b2598e
commit 2fa171c43a
1 changed files with 8 additions and 3 deletions

View File

@ -66,12 +66,16 @@ using namespace llvm;
namespace {
static cl::opt<unsigned> SkipThresholdFlag(
"amdgpu-skip-threshold",
cl::desc("Number of instructions before jumping over divergent control flow"),
cl::init(12), cl::Hidden);
class SILowerControlFlow : public MachineFunctionPass {
private:
static const unsigned SkipThreshold = 12;
const SIRegisterInfo *TRI;
const SIInstrInfo *TII;
unsigned SkipThreshold;
bool shouldSkip(MachineBasicBlock *From, MachineBasicBlock *To);
@ -95,7 +99,7 @@ public:
static char ID;
SILowerControlFlow() :
MachineFunctionPass(ID), TRI(nullptr), TII(nullptr) { }
MachineFunctionPass(ID), TRI(nullptr), TII(nullptr), SkipThreshold(0) { }
bool runOnMachineFunction(MachineFunction &MF) override;
@ -405,6 +409,7 @@ bool SILowerControlFlow::runOnMachineFunction(MachineFunction &MF) {
const SISubtarget &ST = MF.getSubtarget<SISubtarget>();
TII = ST.getInstrInfo();
TRI = &TII->getRegisterInfo();
SkipThreshold = SkipThresholdFlag;
SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();