[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}
+// CHECK: %1 = cir.const #cir.int<42> : !cir.int<s, 32>
----------------
andykaylor wrote:
The constant here should be stored to the return alloca slot and reloaded before being used in the return statement. That will require setting `returnStatement` here and using it in `emitReturnStmt`. Hopefully, that will cause updates to the test cases below.
https://github.com/llvm/llvm-project/pull/129933
More information about the cfe-commits
mailing list