Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>,
Burhan =?utf-8?b?U8O2xJ/DvHQ=?= <burhan.sog...@gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/157...@github.com>


================
@@ -0,0 +1,94 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir 
-emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+
+void if0() {
+  int x = 0;
+
+  if constexpr (0 == 0) {
+    // CIR: cir.scope {
+    // CIR-NEXT:   %2 = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init]
+    // CIR-NEXT:   %3 = cir.const #cir.int<2> : !s32i
+    // CIR-NEXT:   cir.store %3, %2 : !s32i, !cir.ptr<!s32i>
----------------
andykaylor wrote:

```suggestion
    // CIR-NEXT:   %[[X:.*]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init]
    // CIR-NEXT:   %[[TWO:.*]] = cir.const #cir.int<2> : !s32i
    // CIR-NEXT:   cir.store{{.*}} %[[TWO]], %[[X]]
```
To make tests less brittle, we generally replace value identifiers like `%2` 
with a pattern-match variable as shown above. Also, when I ran this test 
locally, it failed for me because the `cir.store` line I was seeing looked like 
this:

`cir.store align(4) %3, %2 : !s32i, !cir.ptr<!s32i>`

Since this test isn't intended to verify the alignment or the types in this 
store, I suggest simplifying it as above. The `{{.*}}` after `cir.store` means 
that the test will pass with or without an explicit alignment specifier. I've 
also removed the type checks, as they are essentially just noise in this test, 
which is intended to verify correct handling of the `if constexpr` expression.

Please go through and update any tests that have literal value specifiers (e.g. 
`%2`) in this way. It's probably a good idea to make these changes in a 
separate PR.

https://github.com/llvm/llvm-project/pull/157333
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to