Skip to content

Commit ef1ef03

Browse files
[BPF] Fix dst/val mismatch in class ATOMIC_NOFETCH (#107288)
All ATOMIC_NOFETCH insns have "$dst = $val" constraints. So let us enforce "$dst = $val" having the same register type in ATOMIC_NOFETCH as well. Currently, things work since ATOMIC_NOFETCH does not have source code pattern matching. I am experimenting to introduce memory ordering to BPFInstrInfo.td file and pattern matching will be needed. Eventually, for atomic_fetch_*() insns locked insns could be generated if memory ordering is memory_order_relaxed. [1] https://lore.kernel.org/bpf/[email protected]/
1 parent 1254259 commit ef1ef03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/BPF/BPFInstrInfo.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ let Predicates = [BPFNoALU32] in {
790790
class ATOMIC_NOFETCH<BPFWidthModifer SizeOp, string OpType, RegisterClass RegTp,
791791
BPFArithOp Opc, string Opstr>
792792
: TYPE_LD_ST<BPF_ATOMIC.Value, SizeOp.Value,
793-
(outs GPR:$dst),
793+
(outs RegTp:$dst),
794794
(ins MEMri:$addr, RegTp:$val),
795795
"lock *(" #OpType# " *)($addr) " #Opstr# "= $val",
796796
[]> {

0 commit comments

Comments
 (0)