llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Morris Hafner (mmha) <details> <summary>Changes</summary> Functions that CIRGen create such as the atomic functions coming from `createRuntimeFunction` have no declaration. These cannot have an OpenACC routine decl. Check for the existence of a declaration first. --- Full diff: https://github.com/llvm/llvm-project/pull/230338.diff 2 Files Affected: - (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+1-1) - (modified) clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c (+2) ``````````diff diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 523b0356be310..3b15bc136899f 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -3737,7 +3737,7 @@ CIRGenModule::createCIRFunction(mlir::Location loc, StringRef name, // library entity. setFuncInfoAttr(func, funcDecl); - if (this->getLangOpts().OpenACC) { + if (funcDecl && this->getLangOpts().OpenACC) { // We only have to handle this attribute, since OpenACCAnnotAttrs are // handled via the end-of-TU work. for (const auto *attr : diff --git a/clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c b/clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c index 2d13ec37a4c2a..5416f275eae8d 100644 --- a/clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c +++ b/clang/test/CIR/CodeGen/builtin-atomic-is-lock-free.c @@ -4,6 +4,8 @@ // RUN: FileCheck --check-prefixes=LLVM,LLVMCIR --input-file=%t-cir.ll %s // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll // RUN: FileCheck --check-prefixes=LLVM,OGCG --input-file=%t.ll %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenacc -fclangir -emit-cir %s -o %t-acc.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t-acc.cir %s typedef struct { char buf[24]; } Big; `````````` </details> https://github.com/llvm/llvm-project/pull/230338 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
