[all-commits] [llvm/llvm-project] 568678: [BPF] Fix BitCast Assertion with NonZero AddrSpace...
yonghong-song via All-commits
all-commits at lists.llvm.org
Tue Mar 11 11:24:15 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5686786c550c6da6d1169b9bffc31cece1161902
https://github.com/llvm/llvm-project/commit/5686786c550c6da6d1169b9bffc31cece1161902
Author: yonghong-song <yhs at fb.com>
Date: 2025-03-11 (Tue, 11 Mar 2025)
Changed paths:
M llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp
A llvm/test/CodeGen/BPF/CORE/arena_bitcast.ll
Log Message:
-----------
[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 at linux.dev>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list