diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -503,6 +503,11 @@ F->setDoesNotThrow(); F->setDoesNotRecurse(); + // TODO: should not need this once amdgcn handles function pointers properly. + if (CGM.getTriple().isAMDGCN()) { + F->removeFnAttr(llvm::Attribute::OptimizeNone); + } + // Generate the function. CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, Args, Loc, Loc); Address ContextAddr = CGF.GetAddrOfLocalVar(CD->getContextParam()); @@ -665,8 +670,14 @@ F->setDoesNotRecurse(); // Always inline the outlined function if optimizations are enabled. - if (CGM.getCodeGenOpts().OptimizationLevel != 0) + if (CGM.getCodeGenOpts().OptimizationLevel != 0) { F->addFnAttr(llvm::Attribute::AlwaysInline); + } + + // TODO: remove this once amdgcn handles function pointers properly. + if (CGM.getTriple().isAMDGCN()) { + F->removeFnAttr(llvm::Attribute::OptimizeNone); + } // Generate the function. CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, TargetArgs,