Index: lib/Target/AMDGPU/AMDGPU.h =================================================================== --- lib/Target/AMDGPU/AMDGPU.h +++ lib/Target/AMDGPU/AMDGPU.h @@ -144,7 +144,7 @@ TargetMachine *TM = nullptr, CodeGenOpt::Level OptLevel = CodeGenOpt::Default); ModulePass *createAMDGPUAlwaysInlinePass(bool GlobalOpt = true); -ModulePass *createAMDGPUOpenCLImageTypeLoweringPass(); +ModulePass *createR600OpenCLImageTypeLoweringPass(); FunctionPass *createAMDGPUAnnotateUniformValues(); ModulePass* createAMDGPUUnifyMetadataPass(); Index: lib/Target/AMDGPU/AMDGPUTargetMachine.cpp =================================================================== --- lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -621,7 +621,8 @@ } // Handle uses of OpenCL image2d_t, image3d_t and sampler_t arguments. - addPass(createAMDGPUOpenCLImageTypeLoweringPass()); + if (TM.getTargetTriple().getArch() == Triple::r600) + addPass(createR600OpenCLImageTypeLoweringPass()); // Replace OpenCL enqueued block function pointers with global variables. addPass(createAMDGPUOpenCLEnqueuedBlockLoweringPass()); Index: lib/Target/AMDGPU/CMakeLists.txt =================================================================== --- lib/Target/AMDGPU/CMakeLists.txt +++ lib/Target/AMDGPU/CMakeLists.txt @@ -42,7 +42,6 @@ AMDGPUMacroFusion.cpp AMDGPUMCInstLower.cpp AMDGPUOpenCLEnqueuedBlockLowering.cpp - AMDGPUOpenCLImageTypeLoweringPass.cpp AMDGPUPromoteAlloca.cpp AMDGPURegAsmNames.inc.cpp AMDGPURegisterBankInfo.cpp @@ -70,6 +69,7 @@ R600ISelLowering.cpp R600MachineFunctionInfo.cpp R600MachineScheduler.cpp + R600OpenCLImageTypeLoweringPass.cpp R600OptimizeVectorRegisters.cpp R600Packetizer.cpp R600RegisterInfo.cpp Index: lib/Target/AMDGPU/R600OpenCLImageTypeLoweringPass.cpp =================================================================== --- lib/Target/AMDGPU/R600OpenCLImageTypeLoweringPass.cpp +++ lib/Target/AMDGPU/R600OpenCLImageTypeLoweringPass.cpp @@ -1,4 +1,4 @@ -//===- AMDGPUOpenCLImageTypeLoweringPass.cpp ------------------------------===// +//===- R600OpenCLImageTypeLoweringPass.cpp ------------------------------===// // // The LLVM Compiler Infrastructure // @@ -153,7 +153,7 @@ namespace { -class AMDGPUOpenCLImageTypeLoweringPass : public ModulePass { +class R600OpenCLImageTypeLoweringPass : public ModulePass { static char ID; LLVMContext *Context; @@ -364,7 +364,7 @@ } public: - AMDGPUOpenCLImageTypeLoweringPass() : ModulePass(ID) {} + R600OpenCLImageTypeLoweringPass() : ModulePass(ID) {} bool runOnModule(Module &M) override { Context = &M.getContext(); @@ -376,14 +376,14 @@ } StringRef getPassName() const override { - return "AMDGPU OpenCL Image Type Pass"; + return "R600 OpenCL Image Type Pass"; } }; } // end anonymous namespace -char AMDGPUOpenCLImageTypeLoweringPass::ID = 0; +char R600OpenCLImageTypeLoweringPass::ID = 0; -ModulePass *llvm::createAMDGPUOpenCLImageTypeLoweringPass() { - return new AMDGPUOpenCLImageTypeLoweringPass(); +ModulePass *llvm::createR600OpenCLImageTypeLoweringPass() { + return new R600OpenCLImageTypeLoweringPass(); }