Skip to content

LLVM: lower fixed-array params as byval aggregates#57

Merged
itsfuad merged 1 commit into
mainfrom
llvm-array-param-lowering-fix
Apr 27, 2026
Merged

LLVM: lower fixed-array params as byval aggregates#57
itsfuad merged 1 commit into
mainfrom
llvm-array-param-lowering-fix

Conversation

@itsfuad

@itsfuad itsfuad commented Apr 27, 2026

Copy link
Copy Markdown
Member

Summary

Fix LLVM lowering for fixed-array function parameters (for example [2]i32) so they are emitted as aggregate byval params instead of falling through scalar base-type lowering.

Fixes #56

What changed

  • llvmABITypeName now classifies ArrayType like tuple aggregates and returns sized aggregate ABI type ([N x i8]).
  • llvmBaseType now unwraps ApproxType (~T) before scalar base-type resolution.
  • Added regression test TestLowerProgramFunctionArrayParamUsesByValAggregate to ensure array param lowering stays stable.

Why

Previously, array params could hit:

unsupported llvm base type [N]T

through scalar fallback paths during function lowering.

Validation

  • go test ./internal/backend/llvm -count=1

@itsfuad itsfuad force-pushed the llvm-array-param-lowering-fix branch from e84228b to 698f10b Compare April 27, 2026 19:15
@itsfuad itsfuad merged commit cf94d32 into main Apr 27, 2026
2 checks passed
@itsfuad itsfuad deleted the llvm-array-param-lowering-fix branch April 27, 2026 19:21
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.

LLVM backend: array function parameters can fail with unsupported llvm base type [N]T

1 participant