[clang] [CIR] Upstream a batch of passing tests from CIR-Incubator (PR #157333)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 10 11:49:41 PDT 2025
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sogutt at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/157333 at github.com>
================
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -fclangir -emit-cir -pic-is-pie -pic-level 1 %s -o %t1.cir
+// RUN: FileCheck --input-file=%t1.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple aarch64-none-linux-android21 -fclangir -emit-llvm -pic-is-pie -pic-level 1 %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=LLVM
+
+void foo(int i) {
+
+}
+
+int main() {
+ foo(2);
+ return 0;
+}
+
+// CIR: cir.func dso_local @foo(%arg0: !s32i
+// CIR-NEXT: [[TMP0:%.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["i", init] {alignment = 4 : i64}
+// CIR-NEXT: cir.store %arg0, [[TMP0]] : !s32i, !cir.ptr<!s32i>
+// CIR-NEXT: cir.return
+
+// CIR: cir.func no_proto dso_local @main() -> !s32i
+// CIR: [[TMP1:%.*]] = cir.const #cir.int<2> : !s32i
+// CIR: cir.call @foo([[TMP1]]) : (!s32i) -> ()
+
+// LLVM: define dso_local void @foo(i32 [[TMP3:%.*]])
+// LLVM: [[ARG_STACK:%.*]] = alloca i32, i64 1, align 4
+// LLVM: store i32 [[TMP3]], ptr [[ARG_STACK]], align 4
+// LLVM: ret void
+
+// LLVM: define dso_local i32 @main()
----------------
andykaylor wrote:
In this case, the entire point of the test seems to be to verify that we are generating the expected linkage, preemption specifiers, and visibility when compiling with `-pic-is-pie -pic-level 1`. In order to be sure that CIR stays in sync with the non-CIR codegen path, we need checks here.
The correct OGCG check in this case will be
`// OGCG: define dso_local noundef i32 @main()`
This shows that in the CIR path, we missed the `noundef` return attribute. That's expected right now, but we want to have checks in place so we are alerted if the OGCG output changes.
https://github.com/llvm/llvm-project/pull/157333
More information about the cfe-commits
mailing list