1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/lib
Yonghong Song 907a002a39 bpf: generate better lowering code for certain select/setcc instructions
Currently, for code like below,
===
  inner_map = bpf_map_lookup_elem(outer_map, &port_key);
  if (!inner_map) {
    inner_map = &fallback_map;
  }
===
the compiler generates (pseudo) code like the below:
===
  I1: r1 = bpf_map_lookup_elem(outer_map, &port_key);
  I2: r2 = 0
  I3: if (r1 == r2)
  I4:   r6 = &fallback_map
  I5: ...
===

During kernel verification process, After I1, r1 holds a state
map_ptr_or_null. If I3 condition is not taken
(path [I1, I2, I3, I5]), supposedly r1 should become map_ptr.
Unfortunately, kernel does not recognize this pattern
and r1 remains map_ptr_or_null at insn I5. This will cause
verificaiton failure later on.

Kernel, however, is able to recognize pattern "if (r1 == 0)"
properly and give a map_ptr state to r1 in the above case.

LLVM here generates suboptimal code which causes kernel verification
failure. This patch fixes the issue by changing BPF insn pattern
matching and lowering to generate proper codes if the righthand
parameter of the above condition is a constant. A test case
is also added.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 308080
2017-07-15 05:41:42 +00:00
..
Analysis [TTI] Refine the cost of EXT in getUserCost() 2017-07-15 02:12:16 +00:00
AsmParser Enhance synchscope representation 2017-07-11 22:23:00 +00:00
BinaryFormat Revert "Revert "Revert "Revert "Switch external cvtres.exe for llvm's own resource library."""" 2017-07-08 03:06:10 +00:00
Bitcode Enhance synchscope representation 2017-07-11 22:23:00 +00:00
CodeGen [TTI] Refine the cost of EXT in getUserCost() 2017-07-15 02:12:16 +00:00
DebugInfo Remove set but not used variables from the debug info verifier code. 2017-07-14 01:40:47 +00:00
Demangle [ItaniumDemangle] Fix a exponential string copying bug 2017-05-28 23:24:52 +00:00
ExecutionEngine [ORC] Errorize the ORC APIs. 2017-07-07 02:59:13 +00:00
Fuzzer [libFuzzer] remove stale code 2017-07-15 01:31:40 +00:00
IR [Dominators] Implement incremental deletions 2017-07-14 21:58:53 +00:00
IRReader
LineEditor
Linker [Linker] Add directives to support mixing ARM/Thumb module-level inline asm. 2017-07-12 11:52:28 +00:00
LTO Use DenseMap instead std::map for GVSummaryMapTy. 2017-07-10 20:12:54 +00:00
MC Simplify interface now that we don't need to pass IsPCRel. NFC. 2017-07-11 23:56:10 +00:00
Object [WebAssembly] Expose the offset of each data segment 2017-07-12 00:24:54 +00:00
ObjectYAML [WebAssembly] Expose the offset of each data segment 2017-07-12 00:24:54 +00:00
Option [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified 2017-07-08 17:48:59 +00:00
Passes [PM] Enable registration of out-of-tree passes with PassBuilder 2017-07-10 10:57:55 +00:00
ProfileData llvm-profdata: Reduce memory usage by using Error callback rather than member 2017-07-10 03:04:59 +00:00
Support Put std::mutex usage behind #ifdefs to pacify the sanitizer buildbot 2017-07-13 16:56:24 +00:00
TableGen [BinaryFormat, Option, TableGen] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-06-16 00:43:26 +00:00
Target bpf: generate better lowering code for certain select/setcc instructions 2017-07-15 05:41:42 +00:00
Testing Mark LLVMTestingSupport as not installed in LLVMBuild. 2017-06-19 22:01:50 +00:00
ToolDrivers [GSoC] Flag value completion for clang 2017-06-20 16:31:31 +00:00
Transforms [ThinLTO] Ensure we always select the same function copy to import 2017-07-15 04:53:05 +00:00
XRay Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
CMakeLists.txt [gtest] Create a shared include directory for gtest utilities. 2017-06-14 16:41:50 +00:00
LLVMBuild.txt [gtest] Create a shared include directory for gtest utilities. 2017-06-14 16:41:50 +00:00