Index: lib/Target/R600/AMDGPUTargetMachine.cpp =================================================================== --- lib/Target/R600/AMDGPUTargetMachine.cpp +++ lib/Target/R600/AMDGPUTargetMachine.cpp @@ -33,9 +33,13 @@ #include "llvm/Transforms/Scalar.h" #include - using namespace llvm; +static cl::opt DisablePromoteAlloca( + "disable-amdgpu-promote-alloca", + cl::Hidden, + cl::desc("Disable Promote Alloca for R600")); + extern "C" void LLVMInitializeR600Target() { // Register the target RegisterTargetMachine X(TheAMDGPUTarget); @@ -137,8 +141,11 @@ void AMDGPUPassConfig::addCodeGenPrepare() { const AMDGPUSubtarget &ST = TM->getSubtarget(); - addPass(createAMDGPUPromoteAlloca(ST)); - addPass(createSROAPass()); + if (!DisablePromoteAlloca) { + addPass(createAMDGPUPromoteAlloca(ST)); + addPass(createSROAPass()); + } + TargetPassConfig::addCodeGenPrepare(); }