[all-commits] [llvm/llvm-project] f63405: BPF: Workaround an InstCombine ICmp transformation...
yonghong-song via All-commits
all-commits at lists.llvm.org
Mon Nov 1 14:54:32 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f63405f6e3d30f33e715ef5ad09136127535a3fb
https://github.com/llvm/llvm-project/commit/f63405f6e3d30f33e715ef5ad09136127535a3fb
Author: Yonghong Song <yhs at fb.com>
Date: 2021-11-01 (Mon, 01 Nov 2021)
Changed paths:
M llvm/include/llvm/IR/IntrinsicsBPF.td
M llvm/lib/Target/BPF/BPFAdjustOpt.cpp
M llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp
A llvm/test/CodeGen/BPF/adjust-opt-icmp3.ll
Log Message:
-----------
BPF: Workaround an InstCombine ICmp transformation with llvm.bpf.compare builtin
Commit acabad9ff6bf ("[InstCombine] try to canonicalize icmp with
trunc op into mask and cmp") added a transformation to
convert "(conv)a < power_2_const" to "a & <const>" in certain
cases and bpf kernel verifier has to handle the resulted code
conservatively and this may reject otherwise legitimate program.
This commit tries to prevent such a transformation. A bpf backend
builtin llvm.bpf.compare is added. The ICMP insn, which is subject to
above InstCombine transformation, is converted to the builtin
function. The builtin function is later lowered to original ICMP insn,
certainly after InstCombine pass.
With this change, all affected bpf strobemeta* selftests are
passed now.
Differential Revision: https://reviews.llvm.org/D112938
More information about the All-commits
mailing list