Files
llvm-project/clang/test/CIR/CodeGen/expressions.cpp
adams381 da86595eb2 [CIR][NFC] Add LLVM and OGCG checks to six codegen tests (#191536)
Add CIR-to-LLVM and classic codegen RUN lines to empty.cpp,
c89-implicit-int.c, expressions.cpp, binop.c, forward-enum.c, and
static-vars.c so each test verifies LLVM IR output from both pipelines.

Made with [Cursor](https://cursor.com)
2026-04-13 14:28:58 -05:00

24 lines
957 B
C++

// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
void test(int a) {
// Should generate LValue parenthesis expression.
(a) = 1;
}
// CIR: cir.func {{.*}} @{{.+}}test
// CIR: %[[CONST:.*]] = cir.const #cir.int<1> : !s32i
// CIR: cir.store{{.*}} %[[CONST]], %{{.+}} : !s32i, !cir.ptr<!s32i>
// LLVM: define dso_local void @_Z4testi(i32 noundef %0)
// LLVM: store i32 1, ptr %{{.+}}, align 4
// LLVM: ret void
// OGCG: define dso_local void @_Z4testi(i32 noundef %a)
// OGCG: store i32 1, ptr %{{.+}}, align 4
// OGCG: ret void