[clang] [CIR] Upstream a batch of passing tests from CIR-Incubator (PR #157333)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 8 16:46:21 PDT 2025
================
@@ -0,0 +1,75 @@
+// 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
+
+int foo(int a, int b) {
+ int x = a * b;
+ x *= b;
+ x /= b;
+ x %= b;
+ x += b;
+ x -= b;
+ x >>= b;
+ x <<= b;
+ x &= b;
+ x ^= b;
+ x |= b;
+ return x;
+}
+
+// CHECK: [[Value:%[0-9]+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init] {alignment = 4 : i64}
----------------
andykaylor wrote:
```suggestion
// CHECK: [[Value:%[0-9]+]] = cir.alloca !s32i, !cir.ptr<!s32i>, ["x", init]
```
We generally try to avoid checking things like alignment unless the test intends to check for correct alignment. Usually, it's just an artifact that should be omitted to keep the test focused. Correct alignment is important, but we don't want to have to fix a lot of unrelated tests if a change is made to the alignment handling.
https://github.com/llvm/llvm-project/pull/157333
More information about the cfe-commits
mailing list