tests: normalize LLVM IR when updating goldens - #5574
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the LLVM IR golden-file workflow so regenerated goldens are stored in a normalized form (to reduce LLVM-version churn) and updates an existing golden accordingly.
Changes:
- Update
-updatepaths in transform/compiler tests to avoid unnecessary golden rewrites when outputs are equivalent across LLVM versions. - Normalize LLVM-version-specific IR spellings before writing goldens.
- Refresh
compiler/testdata/large.llto the normalized (pre-LLVM21-style) attribute spellings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| transform/transform_test.go | Adjusts golden update logic for transform tests and applies IR normalization when writing .out.ll files. |
| compiler/compiler_test.go | Adjusts golden update logic for compiler tests and normalizes IR when writing .ll goldens; also refactors comparison to reuse actual. |
| compiler/testdata/large.ll | Updates a golden file to use normalized IR spellings (e.g., nocapture instead of captures(none)). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
59b8cdf to
eecf1ca
Compare
dgryski
left a comment
There was a problem hiding this comment.
LGTM. At some point we should update the version of LLVM that we're normalizing to.
|
The repo's llvm-project clone is 22 so arguably that should be the one being used... |
|
The various regexps in normalizeIR rewrite to pre-LLVM22 versions though ( |
|
Right, I didn't change the status quo in this PR, I was just suggesting 22 for some unspecified future date (which could be now if desired?) |
This bugged me while working on another branch, as
-updatekept overwriting all of my golden files with LLVM 22 outputs instead of the normalized ones. I think it's better to just store it normalized.