https://github.com/adams381 created 
https://github.com/llvm/llvm-project/pull/190691

Add OGCG function signature checks to the three OpenACC atomic test files.  
Verifies CIR produces compatible output with classic Clang codegen.

Made with [Cursor](https://cursor.com)

>From f21d08a2cd8286b074c36565c892237edc5e0272 Mon Sep 17 00:00:00 2001
From: Adam Smith <[email protected]>
Date: Mon, 6 Apr 2026 14:29:01 -0700
Subject: [PATCH] [CIR][NFC] Add OGCG checks to OpenACC atomic tests

Add LLVM codegen verification (OGCG) to the three OpenACC
atomic test files (capture, update, write) to verify CIR
produces compatible output with classic Clang codegen.

Made-with: Cursor
---
 clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp | 3 +++
 clang/test/CIR/CodeGenOpenACC/atomic-update.cpp  | 3 +++
 clang/test/CIR/CodeGenOpenACC/atomic-write.cpp   | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp 
b/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp
index 687cbd73e16fc..b149bd41980d1 100644
--- a/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp
+++ b/clang/test/CIR/CodeGenOpenACC/atomic-capture.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-cir -fclangir -triple 
x86_64-linux-pc %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
 
 struct HasOps {
   operator float();
@@ -7,6 +9,7 @@ struct HasOps {
   int operator++(int);
 };
 
+// OGCG: define {{.*}} void @_Z3useiif6HasOps(i32 {{.*}}, i32 {{.*}}, float 
{{.*}})
 void use(int x, int v, float f, HasOps ops) {
   // CHECK: cir.func{{.*}}(%[[X_ARG:.*]]: !s32i{{.*}}, %[[V_ARG:.*]]: 
!s32i{{.*}}, %[[F_ARG:.*]]: !cir.float{{.*}}){{.*}}, %[[OPS_ARG:.*]]: 
!rec_HasOps{{.*}}) {{.*}}{
   // CHECK-NEXT: %[[X_ALLOCA:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", 
init]
diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp 
b/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp
index 65db274222d6a..d8018c9dcb6d9 100644
--- a/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp
+++ b/clang/test/CIR/CodeGenOpenACC/atomic-update.cpp
@@ -1,10 +1,13 @@
 // RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-cir -fclangir -triple 
x86_64-linux-pc %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
 
 struct HasOps {
   operator float();
   int thing();
 };
 
+// OGCG: define {{.*}} void @_Z3useijf6HasOps(i32 {{.*}}, i32 {{.*}}, float 
{{.*}})
 void use(int x, unsigned int y, float f, HasOps ops) {
   // CHECK: cir.func{{.*}}(%[[X_ARG:.*]]: !s32i{{.*}}, %[[Y_ARG:.*]]: 
!u32i{{.*}}, %[[F_ARG:.*]]: !cir.float{{.*}}){{.*}}, %[[OPS_ARG:.*]]: 
!rec_HasOps{{.*}}) {{.*}}{
   // CHECK-NEXT: %[[X_ALLOCA:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", 
init]
diff --git a/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp 
b/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp
index 8c903ac8ce8eb..29b650515c71c 100644
--- a/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp
+++ b/clang/test/CIR/CodeGenOpenACC/atomic-write.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-cir -fclangir -triple 
x86_64-linux-pc %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenacc -triple x86_64-linux-gnu 
-Wno-openacc-self-if-potential-conflict -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
 
 extern "C" bool condition(int x, unsigned int y, float f);
 extern "C" double do_thing(float f);
@@ -7,6 +9,7 @@ struct ConvertsToScalar {
   operator float();
 };
 
+// OGCG: define {{.*}} void @_Z3useijf16ConvertsToScalar(i32 {{.*}}, i32 
{{.*}}, float {{.*}})
 void use(int x, unsigned int y, float f, ConvertsToScalar cts) {
   // CHECK: cir.func{{.*}}(%[[X_ARG:.*]]: !s32i{{.*}}, %[[Y_ARG:.*]]: 
!u32i{{.*}}, %[[F_ARG:.*]]: !cir.float{{.*}}){{.*}}, %[[CTS_ARG:.*]]: 
!rec_ConvertsToScalar{{.*}}) {{.*}}{
   // CHECK-NEXT: %[[X_ALLOC:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", 
init]

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to