[NVPTX] Fix some usages of CodeGenOpt::None.

NVPTXLowerKernelArgs is required for correctness, so it should not be guarded
by CodeGenOpt::None.

NVPTXPeephole is optimization only, so it should be skipped when
CodeGenOpt::None.

llvm-svn: 267619
This commit is contained in:
Jingyue Wu 2016-04-26 22:59:25 +00:00
parent e5030e85ea
commit c1b9d47b3b
1 changed files with 9 additions and 5 deletions

View File

@ -181,7 +181,6 @@ void NVPTXPassConfig::addEarlyCSEOrGVNPass() {
}
void NVPTXPassConfig::addAddressSpaceInferencePasses() {
addPass(createNVPTXLowerKernelArgsPass(&getNVPTXTargetMachine()));
// NVPTXLowerKernelArgs emits alloca for byval parameters which can often
// be eliminated by SROA.
addPass(createSROAPass());
@ -235,6 +234,9 @@ void NVPTXPassConfig::addIRPasses() {
addPass(createNVPTXAssignValidGlobalNamesPass());
addPass(createGenericToNVVMPass());
// NVPTXLowerKernelArgs is required for correctness and should be run right
// before the address space inference passes.
addPass(createNVPTXLowerKernelArgsPass(&getNVPTXTargetMachine()));
if (getOptLevel() != CodeGenOpt::None) {
addAddressSpaceInferencePasses();
addStraightLineScalarOptimizationPasses();
@ -273,10 +275,12 @@ bool NVPTXPassConfig::addInstSelector() {
void NVPTXPassConfig::addPostRegAlloc() {
addPass(createNVPTXPrologEpilogPass(), false);
// NVPTXPrologEpilogPass calculates frame object offset and replace frame
// index with VRFrame register. NVPTXPeephole need to be run after that and
// will replace VRFrame with VRFrameLocal when possible.
addPass(createNVPTXPeephole());
if (getOptLevel() != CodeGenOpt::None) {
// NVPTXPrologEpilogPass calculates frame object offset and replace frame
// index with VRFrame register. NVPTXPeephole need to be run after that and
// will replace VRFrame with VRFrameLocal when possible.
addPass(createNVPTXPeephole());
}
}
FunctionPass *NVPTXPassConfig::createTargetRegisterAllocator(bool) {