[all-commits] [llvm/llvm-project] 8fb3f8: BPF: Workaround InstCombine trunc+icmp => mask+icm...

yonghong-song via All-commits all-commits at lists.llvm.org
Thu Nov 18 20:27:45 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8fb3f84484094230d563c1e4c1088755b7cde15b
      https://github.com/llvm/llvm-project/commit/8fb3f84484094230d563c1e4c1088755b7cde15b
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-11-18 (Thu, 18 Nov 2021)

  Changed paths:
    M llvm/lib/Target/BPF/BPFAdjustOpt.cpp
    A llvm/test/CodeGen/BPF/adjust-opt-icmp4.ll

  Log Message:
  -----------
  BPF: Workaround InstCombine trunc+icmp => mask+icmp Optimization

Patch [1] added further InstCombine trunc+icmp => mask+icmp
optimization and this caused a couple of bpf selftest failure.
Previous llvm BPF backend patch [2] introduced llvm.bpf.compare
builtin to handle such situations.

This patch further added support ">" and ">=" icmp opcodes.
Tested with bpf selftests and all tests are passed including two
previously failed ones.

Note Patch [1] also added optimization if the to-be-compared
constant is negative-power-of-2 (-C) or not-of-power-of-2 (~C).
This patch didn't implement these two cases as typical bpf
program compares a scalar to a positive length or boundary value,
and this scalar later is used as a index into an array buffer
or packet buffer.

  [1] https://reviews.llvm.org/D112634
  [2] https://reviews.llvm.org/D112938

Differential Revision: https://reviews.llvm.org/D114215




More information about the All-commits mailing list