[clang] [CIR] Add if statement support (PR #134333)

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 8 11:14:02 PDT 2025


================
@@ -0,0 +1,50 @@
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
+// RUN: %clang_cc1 -std=c++23 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+
+void f() {
+  int result = 0;
+
+  if consteval {
+    result = 10; 
+    // CIR-NOT: cir.const #cir.int<10> : !s32i
+    // LLVM-NOT: store i32 10, ptr %1, align 4
----------------
Andres-Salamanca wrote:

🤯🤯 I hadn’t thought of that

https://github.com/llvm/llvm-project/pull/134333


More information about the cfe-commits mailing list