[PATCH] D73997: [BPF] disable ReduceLoadWidth during SelectionDag phase
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 14:41:56 PST 2020
yonghong-song created this revision.
yonghong-song added reviewers: ast, anakryiko.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
The compiler may transform the following code
(e.g., the test case in this commit)
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73997
Files:
llvm/lib/Target/BPF/BPFISelLowering.h
llvm/test/CodeGen/BPF/CORE/no-narrow-load.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73997.242433.patch
Type: text/x-patch
Size: 9619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/5e25ad31/attachment.bin>
More information about the llvm-commits
mailing list