[all-commits] [llvm/llvm-project] 795bbb: [BPF] fix a bug in BPFMISimplifyPatchable pass wit...

yonghong-song via All-commits all-commits at lists.llvm.org
Thu Jan 30 08:29:22 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 795bbb366266e83d2bea8dc04c19919b52ab3a2a
      https://github.com/llvm/llvm-project/commit/795bbb366266e83d2bea8dc04c19919b52ab3a2a
  Author: Yonghong Song <yhs at fb.com>
  Date:   2020-01-30 (Thu, 30 Jan 2020)

  Changed paths:
    M llvm/lib/Target/BPF/BPFMISimplifyPatchable.cpp
    A llvm/test/CodeGen/BPF/optnone-1.ll

  Log Message:
  -----------
  [BPF] fix a bug in BPFMISimplifyPatchable pass with -O0

The recommended optimization level for BPF programs
is O2 since (1). BPF is running inside the kernel and
linux kernel won't work at -O0 level, and (2). Verifier
is not able to handle O0 code properly, e.g., potential
large stack size and a lot of spills.

But we should keep -O0 at least compiling.
This patch fixed a bug in BPFMISimplifyPatchable phase
where with -O0, a segmentation fault will happen for a
simple program like:
  int test(int a, int b) { return a + b; }

A test case is added to capture such a case.

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




More information about the All-commits mailing list