LLVM 22.x tile for building compilers, language runtimes, and out-of-tree tooling
88
83%
Does it follow best practices?
Impact
96%
1.23xAverage score across 5 eval scenarios
Passed
No known issues
A compiler team just landed an in-tree LLVM pass called constfold-demo that performs several simple optimizations on integer arithmetic: it folds x + 0 to x, x * 1 to x, and x - x to 0. The pass also eliminates branches whose condition is a constant true or false.
Before merging to the main branch, the team lead requires a proper lit test file that validates each transformation using FileCheck. The test file will live at test/Transforms/ConstFoldDemo/constfold-demo.ll and will be run as part of CI with llvm-lit.
The team has seen CI failures caused by tests that appeared to pass but produced incorrect results silently, and by tests that broke whenever someone renamed an internal IR value. The lead wants a robust test file that follows LLVM testing best practices to avoid these recurring issues.
Produce a single file constfold-demo.ll that:
The test file should be ready to run with:
llvm-lit constfold-demo.ll(assuming opt is on PATH and the pass is registered as constfold-demo)
docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
add-alias-analysis
add-attributes-metadata
add-calling-convention
add-debug-info
add-exception-handling
add-gc-statepoints
add-intrinsic
add-lto
add-sanitizer
add-vectorization-hint
frontend-to-ir
jit-setup
lit-filecheck
lower-struct-types
new-target
out-of-tree-setup
tessl-llvm
version-sync