[clang] [CIR][AMDGPU] Fix address space of __builtin_frame_address result (PR #233724)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 03:08:46 PDT 2026


================
@@ -2538,8 +2538,9 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
     mlir::Value addr = cir::FrameAddrOp::create(
         builder, loc, allocaInt8PtrTy,
         builder.getConstAPInt(loc, builder.getUInt32Ty(), level));
-    return RValue::get(
-        builder.createCast(loc, cir::CastKind::bitcast, addr, voidPtrTy));
+    addr = builder.createBitcast(
+        addr, builder.getVoidPtrTy(getCIRAllocaAddressSpace()));
+    return RValue::get(performAddrSpaceCast(addr, convertType(e->getType())));
----------------
steffenlarsen wrote:

Looks right to me. Should we maybe do a wider sweep to see if there are other builtins that use `AllocaInt8PtrTy` in OGCG?

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


More information about the cfe-commits mailing list