镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Codegen emits dangling LLVM metadata reference (!alias.scope !201) — blocks multi-module compile #71

Closed

Description

@proggeramlug

Summary

Perry 0.5.78 emits a dangling LLVM metadata reference in the IR for some modules, causing clang to fail:

error: use of undefined metadata '!201'
  store i8 %r35, ptr %r34, !alias.scope !201, !noalias !301

The metadata !201 is referenced in the IR but never defined. Happens specifically in src/types/codecs/scalars.ts (the @perry/postgres codec file) but likely affects any module where the new alias-scope metadata from the escape-analysis / scalar-replacement passes (#66, v0.5.76) is emitted without a matching definition.

Repro

perry compile bench/bench-this.ts -o /tmp/bench-this
Error compiling module 'src/types/codecs/scalars.ts':
  .ll:2789:42: error: use of undefined metadata '!201'
    store i8 %r35, ptr %r34, !alias.scope !201, !noalias !301

The failing IR is left at the temp path shown in the error. All other modules in the project compile fine — only scalars.ts triggers it.

Likely cause

The !alias.scope / !noalias metadata was added by the escape-analysis scalar-replacement pass (v0.5.73 / v0.5.76). The metadata numbering is probably emitted assuming a contiguous !0 through !N sequence, but some intermediate pass (dead-code elimination? function inlining?) drops a metadata definition while leaving a reference.

The IR file at the temp path has the full context if needed.

Impact

Blocks compilation of @perry/postgres (and any project whose codegen hits the same path) on 0.5.78. Single-file programs that don't trigger the scalar-replacement pass compile fine.

Environment

  • Perry 0.5.78
  • macOS 26 / Apple Silicon
  • Repro: perry compile bench/bench-this.ts in @perry/postgres repo

Activity

  1. added a commit that references this issue on Apr 22, 2026
    863016a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions