upgrade-llvm

Upgrade the vendored LLVM submodule in ponyc across major versions.

6.2k|438|Updated Nov 13, 2012
One-click install
npx skills add https://github.com/ponylang/ponyc --skill upgrade-llvm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: upgrade-llvm
Source: https://github.com/ponylang/ponyc/tree/main/.claude/skills/upgrade-llvm
Command: npx skills add https://github.com/ponylang/ponyc --skill upgrade-llvm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Upgrading the LLVM version vendored into the ponyc compiler is error-prone: the submodule is a shallow clone, patches may or may not have been upstreamed, LLVM APIs change or disappear between major versions, and some failures only surface when ponyc compiles a Pony program rather than at build time. This Skill provides the exact step-by-step procedure to perform the upgrade safely.

Core Features & Use Cases

  • Per-version commit strategy: Upgrade one major LLVM version at a time with separate commits so the branch can be bisected when something breaks.
  • Patch and hash management: Check each patch in lib/llvm/patches/ with forward and reverse git apply checks, and update LLVM_DESIRED_HASH and PATCHES_DESIRED_HASH in lib/CMakeLists.txt.
  • API migration guidance: Covers common LLVM C and C++ API changes (constant expression removal, deprecated functions, intrinsic signature changes, new link dependencies) with concrete before/after code examples.
  • Use Case: You need to move ponyc from LLVM 21 to LLVM 22. Follow the steps to fetch the new tag shallowly, re-check patches, rebuild LLVM and ponyc, fix codegen compile errors, run the ci-core test label, and add a release note.

Quick Start

Ask the AI to upgrade ponyc's vendored LLVM submodule from the current version to a specific newer LLVM release and follow the documented per-version procedure.

Frequently Asked Questions about upgrade-llvm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I upgrade the vendored LLVM in ponyc?

Upgrade one major version at a time: fetch the new llvmorg tag with --depth 1 in lib/llvm/src, update LLVM_DESIRED_HASH in lib/CMakeLists.txt, re-check each patch, commit the submodule pointer, rebuild LLVM and ponyc, then run ctest with the ci-core label.

How do I check if an LLVM patch has been upstreamed?

Run git apply --check with the same flags the build uses; if the forward check fails, run the reverse check. Forward failing while reverse passes on a freshly reset tree means LLVM upstreamed the change, so delete the patch file.

Why does ponyc build fine but fail when compiling Pony programs after an LLVM upgrade?

LLVM can change an intrinsic's signature without breaking the C API, so ponyc compiles cleanly but emits invalid IR. The failure appears as a module verification error at Pony compile time, which is why running the ci-core tests is mandatory.

What LLVM API changes commonly break ponyc's codegen?

Removed LLVMConst* constant expression functions (replaced by LLVMBuild* equivalents), deprecated functions that fail the -Werror build, C++ API changes in DIBuilder and optimizer callbacks, and new link dependencies such as ntdll.lib on Windows.

Why does the LLVM submodule fetch download the entire llvm-project history?

The submodule is a shallow clone created with --depth 1 and no tags. A plain git fetch of a tag deepens it to full history; always pass --depth 1 when fetching the new llvmorg tag to keep the clone shallow.

What should I do when the patch hash mismatch error appears during the build?

The lib configure step prints both the actual and desired hashes when patch files change. Copy the actual hash into PATCHES_DESIRED_HASH in lib/CMakeLists.txt rather than trying to compute the SHA256 yourself.