diff options
| author | Yonghong Song <yhs@fb.com> | 2017-06-16 15:41:16 +0000 |
|---|---|---|
| committer | Yonghong Song <yhs@fb.com> | 2017-06-16 15:41:16 +0000 |
| commit | ac2e25026fa7a198c33fe521d9c02865ede12981 (patch) | |
| tree | f0978fc9ca074bf6d9272805f2191408eb049d6b /llvm/test/Transforms/LoopVectorize/float-induction.ll | |
| parent | 5c6543961771fa3345b9cfd5785cfc8cde7f0a37 (diff) | |
| download | bcm5719-llvm-ac2e25026fa7a198c33fe521d9c02865ede12981.tar.gz bcm5719-llvm-ac2e25026fa7a198c33fe521d9c02865ede12981.zip | |
bpf: avoid load from read-only sections
If users tried to have a structure decl/init code like below
struct test_t t = { .memeber1 = 45 };
It is very likely that compiler will generate a readonly section
to hold up the init values for variable t. Later load of t members,
e.g., t.member1 will result in a read from readonly section.
BPF program cannot handle relocation. This will force users to
write:
struct test_t t = {};
t.member1 = 45;
This is just inconvenient and unintuitive.
This patch addresses this issue by implementing BPF PreprocessISelDAG.
For any load from a global constant structure or an global array of
constant struct, it attempts to
translate it into a constant directly. The traversal of the
constant struct and other constant data structures are similar
to where the assembler emits read-only sections.
Four different unit test cases are also added to cover
different scenarios.
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 305560
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/float-induction.ll')
0 files changed, 0 insertions, 0 deletions

