diff options
author | yonghong-song <yhs@fb.com> | 2025-03-11 11:23:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-11 11:23:53 -0700 |
commit | 5686786c550c6da6d1169b9bffc31cece1161902 (patch) | |
tree | dcd170f5a27498749ebbd910fb7939469ce7ee88 /llvm/lib/Support/LockFileManager.cpp | |
parent | 313e2ef93eb2cb257e643c87916df8471ff01fd8 (diff) | |
download | llvm-5686786c550c6da6d1169b9bffc31cece1161902.zip llvm-5686786c550c6da6d1169b9bffc31cece1161902.tar.gz llvm-5686786c550c6da6d1169b9bffc31cece1161902.tar.bz2 |
[BPF] Fix BitCast Assertion with NonZero AddrSpace (#130722)
Alexei reported a bpf selftest failure with recent llvm for bpf prog
file progs/arena_spin_lock.c. The failure only happens when clang is
built with cmake option LLVM_ENABLE_ASSERTIONS=ON.
The error message looks like:
```
clang: /home/yhs/work/yhs/llvm-project/llvm/lib/IR/Instructions.cpp:3460:
llvm::BitCastInst::BitCastInst(Value *, Type *, const Twine &, InsertPosition):
Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
```
Further investigation shows that the problem is triggered in
BPF/BPFAbstractMemberAccess.cpp
for code
```
auto *BCInst =
new BitCastInst(Base, PointerType::getUnqual(BB->getContext()));
```
For the above BitCastInst, Since 'Base' has non-zero AddrSapce, the
compiler expects the type also has the same AddrSpace. But the above
PointerType::getUnqual(...) does not have AddrSpace and hence causes the
assertion failure.
Providing the proper AddrSpace for the BitCast type fixed the issue.
Co-authored-by: Yonghong Song <yonghong.song@linux.dev>
Diffstat (limited to 'llvm/lib/Support/LockFileManager.cpp')
0 files changed, 0 insertions, 0 deletions