Skip to content

Document today's new APIs in the manual - #695

Merged
maleadt merged 4 commits into
mainfrom
tb/docs-new-apis
Oct 19, 2026
Merged

maleadt merged 4 commits into
mainfrom
tb/docs-new-apis

Conversation

@maleadt

@maleadt maleadt commented Oct 19, 2026

Copy link
Copy Markdown
Member

The APIs merged today (#678–#683, #686, #690–#692) all have docstrings and are listed in the API reference, so checkdocs passes. Two things were still missing for someone who hasn't read the code:

  • A few functions were filed on the wrong API page. split_block!, split_block_and_insert_if_then! and split_block_and_insert_if_then_else! were under the dominator tree analysis. promote_mem_to_reg! and is_promotable were with the operations on single instructions. They all change the IR, so they now sit on the transforms page next to inlining.
  • The manual had no examples for most of the new features. This PR adds doctested examples:
    • Transforms, "IR transforms": promote_mem_to_reg!, inline!, simplify_instruction and split_block_and_insert_if_then! (with branch weights) run on small functions. The section also explains how these utilities differ from passes, for example that they don't keep analyses up to date.
    • Metadata: when to use add_metadata! instead of assigning to obj.metadata[kind], and why a pass calls drop_unknown_metadata! on an instruction it moves. It also points to map_metadata for cloned IR.
    • Analyses, "Loops and scalar evolution": a custom pass that gets LoopInfo and ScalarEvolution from its analysis manager, and prints a loop's backedge-taken count and the step of its induction variable.

Value mapping and cloning (ValueMap, map_value, map_metadata) already had a section in the transforms manual from #683, so this PR doesn't change it.

The PR only changes docs. The docs build passes locally on Julia 1.12 with LLVMExtra built from the current deps/LLVMExtra, and all doctests pass.

split_block!, split_block_and_insert_if_then! and its else variant were listed with the
dominator tree analysis, and promote_mem_to_reg! and is_promotable with the operations on
single instructions. They change the IR, so list them on the transforms page, next to
inlining.
Show promote_mem_to_reg!, inline!, simplify_instruction and
split_block_and_insert_if_then! at work on small functions, in a section of the
transforms page that explains how they differ from passes.
Explain when to add a metadata attachment instead of replacing one, and why a pass drops
the metadata of an instruction it moves, and point to map_metadata for cloned IR.
The analyses page did not mention LoopInfo and ScalarEvolution yet. Show how a custom pass
gets them, and use them to print the trip count and the induction variable of a loop.
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@           Coverage Diff           @@
##             main     #695   +/-   ##
=======================================
  Coverage   95.07%   95.07%           
=======================================
  Files          58       58           
  Lines        6999     6999           
=======================================
  Hits         6654     6654           
  Misses        345      345           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt
maleadt merged commit 1bc1c65 into main Oct 19, 2026
36 checks passed
@maleadt
maleadt deleted the tb/docs-new-apis branch October 19, 2026 18:37
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.

1 participant