[clang] [CIR] Upstream emitAndUpdateRetAlloca (PR #129933)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 15:02:19 PST 2025
================
@@ -13,8 +13,9 @@ void voidret() { return; }
int intfunc() { return 42; }
// CHECK: cir.func @intfunc() -> !cir.int<s, 32> {
-// CHECK: %0 = cir.const #cir.int<42> : !cir.int<s, 32>
-// CHECK: cir.return %0 : !cir.int<s, 32>
+// CHECK: %0 = cir.alloca !cir.int<s, 32>, !cir.ptr<!cir.int<s, 32>>, ["__retval"] {alignment = 4 : i64}
----------------
andykaylor wrote:
I realize you were just following the style of the existing test, but in general it's preferable to use a substitution variable for IR identifiers that need to be matched or omit them from the check if they don't need to be matched.
```suggestion
// CHECK: %[[RET_ALLOCA:.*]] = cir.alloca !cir.int<s, 32>, !cir.ptr<!cir.int<s, 32>>, ["__retval"] {alignment = 4 : i64}
```
https://github.com/llvm/llvm-project/pull/129933
More information about the cfe-commits
mailing list