<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153917>153917</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
LVM trunk cannot be built with LLVM 21.1-rc3 when using AutoPGO due to lifetime intrinsic incompatibility
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chatgpt-copypasta
</td>
</tr>
</table>
<pre>
### Description
Building LLVM trunk (commit 76d993bd25ff or later) with LLVM 21.1-rc3 as the host compiler fails during the instrumented build phase of AutoPGO. The build fails with IR verification errors about lifetime intrinsics having incorrect argument types.
### Root Cause
Commit c23b4fbdbb70 "[IR] Remove size argument from lifetime intrinsics (#150248)" removed the size argument from `llvm.lifetime.start/end` intrinsics. When using LTO during the AutoPGO instrumented build, IR generated by the older host compiler (21.1-rc3) contains the old signature with size arguments, but trunk's verifier expects the new signature without them.
### System Configuration
- **OS**: Linux 6.16.1-zen1 x86_64
- **CPU**: AMD Ryzen 9 9950X (Zen5)
- **Host Compiler**: LLVM 21.1-rc3
- **Target**: LLVM trunk @ 76d993bd25ff (929 commits after breaking change)
- **Build Method**: Custom AutoPGO script with aggressive optimizations
### Reproduction
Using LLVM's AutoPGO script or custom build with these flags:
```bash
BASE_CFLAGS="-O3 -march=znver5 -mtune=znver5 -mcmodel=medium -pipe"
BASE_CFLAGS+=" -flto=thin -fno-semantic-interposition"
BASE_CFLAGS+=" -mavx512f -mavx512bw -mavx512dq -mavx512vl -mfma -mbmi2"
BASE_CFLAGS+=" -mllvm -vp-counters-per-site=111"
BASE_CFLAGS+=" -mllvm -inline-threshold=1000"
BASE_CFLAGS+=" -mllvm -unroll-threshold=500"
python3 llvm/utils/collect_and_build_with_pgo.py \
--llvm-dir /home/matthew/build/llvm-project/llvm \
--stages instrumented
```
### Failure Point
Stage1 builds successfully (394s for 3546 targets), but fails during instrumented build when linking with ThinLTO:
```
*** Building instrumented clang...
[3535/3541 320.860s] Linking CXX executable bin/lld
FAILED: bin/lld
: && /home/matthew/build/llvm22-autopgo/stage1/bin/clang++ -O3 -march=znver5 -mtune=znver5
-mcmodel=medium -pipe -flto=thin -fno-semantic-interposition [...] -o bin/lld [...]
clang++: warning: argument unused during compilation: '-mllvm -vp-counters-per-site=111'
clang++: warning: argument unused during compilation: '-mllvm -inline-threshold=1000'
[...more -mllvm warnings...]
Intrinsic has incorrect argument type!
ptr @llvm.lifetime.start.p0
Intrinsic has incorrect argument type!
ptr @llvm.lifetime.end.p0
[...repeats 18+ times...]
LLVM ERROR: Broken module found, compilation aborted!
Stack dump:
0. Running pass "verify" on module "lib/libLLVMAMDGPUDesc.a(AMDGPUMCTargetDesc.cpp.o at 3730954)"
#0 0x00006279a61a6a27 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/bin/ld.lld+0x38ffa27)
[...stack trace...]
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: linker command failed due to signal
```
The failure occurs when stage1 clang (built with 21.1-rc3, running trunk code) attempts to LTO-link the instrumented build. The IR contains lifetime intrinsics with the old signature from 21.1-rc3's codegen, but trunk's verifier expects the new signature.
### Impact
- Breaks the standard bootstrap workflow where stable releases build trunk
- AutoPGO builds that worked with trunk as of early November 2024 now fail
- Forces users to either:
- Use trunk to build trunk (circular dependency, ironically works)
- Build without AutoPGO/LTO (loses significant performance benefits)
- Revert to commits before c23b4fbdbb70 (loses 929+ commits of improvements)
### Additional Context
- The `-mllvm` flags shown as "unused during compilation" warnings are actually critical for PGO instrumentation, particularly `-vp-counters-per-site=111`
- This worked successfully when building trunk just 24 hours ago, suggesting the incompatibility was introduced very recently or is triggered by specific build configurations
- Using trunk to build trunk (LLVM 22 as host) bypasses the issue since both compiler and verifier agree on the new intrinsic signature
### Expected Behavior
LLVM trunk should be buildable with recent stable releases to maintain a proper bootstrap chain. Either:
1. The verifier should accept both old and new lifetime intrinsic signatures during a transition period
2. The LTO pipeline should handle signature mismatches gracefully
3. This should be documented as a breaking change requiring LLVM 22+ to build trunk with AutoPGO/LTO
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysWFtv2zoS_jXMy0CGTFm-POTBduqzBdJtkba7xb4EFDWSeCqROiRlx_31iyHlSy7tFosDGIhik8PhN_PNfCPhnKo14i3LNyy_uxGDb4y9lY3wde8TafpjL5wXN4Upj7eMZ_EDd-ikVb1XRrN0vRlUWypdw_39vz6At4P-Dowvpek65WExL1errCh5XlVgLLTCo2V8BQflm7iFTyfTxMoMhAPfIDTGeZCm61WLFiqhWgflYOkI-llp5-3QofZYQkGHQ98Ih2AqWA_efPrj4wS-NDj-FveH094_wB6tqpQU5DugtcY6EIUZPLSqQq86su-t0k5JB43Y06lKS2MtSg_C1uFk8Mce3YSla_qcgXkwxsNWDA5Zut5GACTPillVlEWxSIFxzvLN-weW38EDdmaP4NQPvNitrOnedIXxJePZNE_5bMn4inEONhgoAyhvWGHztG333eRkbeK8sJ7xHeqSzdMr4xP4d4MaBhei-OXjNdojom-gzviWEK1RoxXh22PYYdoS7YsgMr48RZliL432Qml3Wg-Uh8IPFmOgnt3G0UHF4GNqMb5wYxTRAj71KH20o_Hwwg6F1TfYvYrT56Pz2MHW6ErVgxVjJifA-Jrx9cfP8S_L1nCv9PAE88l0PpkmP1BP4Wk5f5zPrpZvP329rF9_uIOH4w_UsILVKk-_0d3_gzqnoF32_IPg2Y7wXJ12zYer5V-ErdG_WDdSbZY-Jxnjy1XAmNLPgag8Wigsiu8UU9kIXeNzZwKD4QP6xpSXM7aD86Y7J0CkfIyPqGuLzqk9gum96tSPAKF7xQfsrSkHOeL71Z3KRIjiC8vGgoxHRuKGk3yDDqFqRe1YFozP0_gphGuo-qw_v3vc7u7Xf3xm2R3jPPmYQdIJKxuW3f3Qe7Q5JJ0fNF7_LztTYsuyuw5LNXSQ9KpHYudzi3wTjUJStd6w7M43SkNSaZM47IT2SiZKe7S9cSrc8hcmOrF_yqe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