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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 06:27:07 PDT 2025


================
@@ -0,0 +1,254 @@
+// RUN: %clang_cc1 -std=c++17 -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++17 -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++17 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+
+int if0(bool a) {
+
+  if (a)
----------------
erichkeane wrote:

Hmm... the idea of having a test BASED on 'x' on the RHS was important.

Do we have int-to-bool decay that you could do `if (int x = 42; x)` ? 

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


More information about the cfe-commits mailing list