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

yonghong-song via All-commits all-commits at lists.llvm.org
Mon Feb 3 07:05:13 PST 2020


  Branch: refs/heads/release/10.x
  Home:   https://github.com/llvm/llvm-project
  Commit: b905b85eedfcf33e7969de1068086889d490ba17
      https://github.com/llvm/llvm-project/commit/b905b85eedfcf33e7969de1068086889d490ba17
  Author: Yonghong Song <yhs at fb.com>
  Date:   2020-02-03 (Mon, 03 Feb 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

(cherry picked from commit 795bbb366266e83d2bea8dc04c19919b52ab3a2a)




More information about the All-commits mailing list