[all-commits] [llvm/llvm-project] 13fdde: [BPF] Emit proper error message for insns with tie...
yonghong-song via All-commits
all-commits at lists.llvm.org
Wed Jul 2 18:28:26 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 13fddeaf2c494e2f88ef4e7063ae2ee3278e4f1e
https://github.com/llvm/llvm-project/commit/13fddeaf2c494e2f88ef4e7063ae2ee3278e4f1e
Author: yonghong-song <yhs at fb.com>
Date: 2025-07-02 (Wed, 02 Jul 2025)
Changed paths:
M llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
A llvm/test/MC/BPF/bad-tied.s
Log Message:
-----------
[BPF] Emit proper error message for insns with tied operands (#146778)
Jonathan Cottrill reported a crash in [1] with the following command
line:
```
$ echo 'r0 = atomic_fetch_add((u64*)(r2 + 0), r1)' | llvm-mc --arch bpf --filetype null
```
Note that in the above command, the insn specification requires that r0
and r1 must be the same register. Otherwise, the crash will happen.
Let us add a case Match_InvalidTiedOperand to handle such invalid insns.
With this patch, the error message looks like below:
```
<stdin>:1:39: error: operand is not the same as the dst register
r0 = atomic_fetch_add((u64*)(r2 + 0), r1)
^
```
The error message is much better than the crash. Some other insns are
also covered by this patch.
```
$ echo 'w0 = xchg32_32(r2 + 0, w1)' | llvm-mc --arch bpf --filetype null
<stdin>:1:24: error: operand is not the same as the dst register
w0 = xchg32_32(r2 + 0, w1)
^
```
[1] https://github.com/llvm/llvm-project/issues/145180
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