llvm-project
6719ec1e - [Coroutines] Replace struct alloca frame with byte array and ptradd (#178359)

Commit
48 days ago
[Coroutines] Replace struct alloca frame with byte array and ptradd (#178359) Replace coroutine frame struct type with a simple byte array and use offset-based ptradd operations instead of struct GEP for all field access. Alloca types have largely lost all meaning to LLVM (even this pass merged them and used an arbitrary type to represent all of them), and so they just makes the code to construct alloca more difficult and less flexible. Key changes: - Remove LayoutFieldIndex from frame field tracking - Remove StructType usage - frame is now a byte array - Replace all CreateStructGEP/CreateConstInBoundsGEP with CreatePtrAdd - Store ResumeOffset/DestroyOffset in SwitchLowering for reuse - Remove Shape.FrameTy, use Shape.FrameSize directly Bug fix: Uses pointer size and alignment from data layout for header pointer offsets in debug info instead of hardcoded 8 byte. Optimization: Replaces load+store patterns with CreateMemCpy for copying allocas to the frame more efficiently. Optimization: Add missing inbounds annotations on existing ptradd calls. Improvement: Preserve debug info of every alloca, even overlapping ones. The frame type is now completely opaque at the IR level. All structure is implicit through computed offsets. Debug info still provides detailed field information using explicit offsets. See further information in dependent PR https://github.com/llvm/llvm-project/pull/178358 as well. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Author
Parents
Loading