[all-commits] [llvm/llvm-project] d96c1b: [BPF] disable ReduceLoadWidth during SelectionDag ...

yonghong-song via All-commits all-commits at lists.llvm.org
Tue Feb 4 18:43:31 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d96c1bbaa03574daf759e5e9a6c75047c5e3af64
      https://github.com/llvm/llvm-project/commit/d96c1bbaa03574daf759e5e9a6c75047c5e3af64
  Author: Yonghong Song <yhs at fb.com>
  Date:   2020-02-04 (Tue, 04 Feb 2020)

  Changed paths:
    M llvm/lib/Target/BPF/BPFISelLowering.h
    A llvm/test/CodeGen/BPF/CORE/no-narrow-load.ll

  Log Message:
  -----------
  [BPF] disable ReduceLoadWidth during SelectionDag phase

The compiler may transform the following code
  ctx = ctx + reloc_offset
  ... (*(u32 *)ctx) & 0x8000 ...
to
  ctx = ctx + reloc_offset
  ... (*(u8 *)(ctx + 1)) & 0x80 ...
where reloc_offset will be replaced with a constant during
AsmPrinter phase.

The above transformed code will be rejected the kernel verifier
as it does not allow
  *(type *)((ctx + non_zero_offset1) + non_zero_offset2)
style access pattern.

It is hard at SelectionDag phase to identify whether a load
is related to context or not. Sometime, interprocedure analysis
may be needed. So let us simply prevent such optimization
from happening.

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




More information about the All-commits mailing list