From a5888a730dfb4c11e4386ee56c65df65d706cf7e Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 13 Nov 2017 22:40:55 +0000 Subject: OpenCL: Assume inline asm is convergent Already done for CUDA. llvm-svn: 318098 --- clang/lib/CodeGen/CGStmt.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 6a78865fc94..7b1afab5f2c 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -2149,10 +2149,11 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { llvm::ConstantAsMetadata::get(Loc))); } - if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice) { - // Conservatively, mark all inline asm blocks in CUDA as convergent - // (meaning, they may call an intrinsically convergent op, such as bar.sync, - // and so can't have certain optimizations applied around them). + if (getLangOpts().assumeFunctionsAreConvergent()) { + // Conservatively, mark all inline asm blocks in CUDA or OpenCL as + // convergent (meaning, they may call an intrinsically convergent op, such + // as bar.sync, and so can't have certain optimizations applied around + // them). Result->addAttribute(llvm::AttributeList::FunctionIndex, llvm::Attribute::Convergent); } -- cgit v1.2.3