Skip to content

Conversation

@RiverDave
Copy link
Collaborator

@RiverDave RiverDave commented Dec 25, 2025

This PR does a couple of things that are closely related:

  1. Address space casting for temporary allocas: Inserts address space casts from the alloca address space to the flat/generic address space when compiling for targets that have a non-default alloca address space (e.g., AMDGPU where allocas are in addrspace(5)). Similar to the way this is done in OG. where CreateMemTemp/CreateTempAlloca calls MaybeCastStackAddressSpace.

  2. Helper to retrieve underlying AllocaOp: In cases where an address space cast wraps the alloca, the defining op is no longer an AllocaOp but a CastOp. Introduced Address::getAllocaOp() to walk through any casts and retrieve the underlying AllocaOp. This is needed when calling allocaOp.setInit() or allocaOp.setConstant() on addresses that may have been cast.

  3. Preserve address spaces at CIR level: Ensures AMDGPU address spaces are correctly represented in CIR for both allocas and globals, with proper lowering to LLVM IR.

Happy Holidays! 🎄

@RiverDave
Copy link
Collaborator Author

RiverDave commented Dec 25, 2025

@github-actions
Copy link

github-actions bot commented Dec 25, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@RiverDave RiverDave force-pushed the 12-24-_cir_cirgen_handle_as_in_temp_allocas_and_override_as_methods_for_amdgpu branch from 1cef3e3 to 3c92f1e Compare December 25, 2025 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants