1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00
llvm-mirror/lib
Yonghong Song f6a86e448a BPF: avoid NE/EQ loop exit condition
Kuniyuki Iwashima reported in [1] that llvm compiler may
convert a loop exit condition with "i < bound" to "i != bound", where
"i" is the loop index variable and "bound" is the upper bound.
In case that "bound" is not a constant, verifier will always have "i != bound"
true, which will cause verifier failure since to verifier this is
an infinite loop.

The fix is to avoid transforming "i < bound" to "i != bound".
In llvm, the transformation is done by IndVarSimplify pass.
The compiler checks loop condition cost (i = i + 1) and if the
cost is lower, it may transform "i < bound" to "i != bound".
This patch implemented getArithmeticInstrCost() in BPF TargetTransformInfo
class to return a higher cost for such an operation, which
will prevent the transformation for the test case
added in this patch.

 [1] https://lore.kernel.org/netdev/1994df05-8f01-371f-3c3b-d33d7836878c@fb.com/

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

(cherry picked from commit e52946b9ababcbf8e6f40b1b15900ae2e795a1c6)
2021-08-06 12:45:53 -07:00
..
Analysis [Analysis] improve function signature checking for snprintf 2021-08-02 22:58:39 -07:00
AsmParser [IR] Rename comdat noduplicates to comdat nodeduplicate 2021-07-20 12:47:10 -07:00
BinaryFormat [SystemZ][z/OS] Add GOFF support to file magic identification 2021-07-20 10:50:47 -04:00
Bitcode [IR] Rename comdat noduplicates to comdat nodeduplicate 2021-07-20 12:47:10 -07:00
Bitstream
CodeGen [DAGCombiner] don't try to partially reduce add-with-overflow ops 2021-08-02 13:52:48 -07:00
DebugInfo [Debug-Info][llvm-dwarfdump] Don't try to dump location 2021-07-27 07:28:59 +00:00
Demangle Demangle: correct swift_async demangling for Microsoft scheme 2021-07-14 11:43:44 -07:00
DWARFLinker [Debug-Info][llvm-dwarfdump] Don't try to dump location 2021-07-27 07:28:59 +00:00
DWP [DWP] Refactoring llvm-dwp in to a library part 2 2021-07-22 14:23:29 -07:00
ExecutionEngine [ORC] Require ExecutorProcessControl when constructing an ExecutionSession. 2021-07-27 16:53:49 +10:00
Extensions
FileCheck [llvm] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
Frontend [mlir][openacc] Initial translation for DataOp to LLVM IR 2021-07-27 22:04:04 -04:00
Fuzzer
FuzzMutate [NewPM][FuzzMutate] Fix renaming 'unswitch' to 'simple-loop-unswitch' 2021-07-09 12:24:12 +02:00
InterfaceStub IFSStub.cpp - consistently use default case to silence 'not all control paths return' MSVC warnings. NFCI. 2021-07-21 11:59:34 +01:00
IR [ConstantFold] Get rid of special cases for sizeof etc. 2021-08-04 21:25:15 -07:00
IRReader
LineEditor llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Linker [IR] Rename comdat noduplicates to comdat nodeduplicate 2021-07-20 12:47:10 -07:00
LTO PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23 2021-07-08 13:37:57 -07:00
MC [SystemZ][z/OS] Initial code to generate assembly files on z/OS 2021-07-27 11:29:15 -04:00
MCA [MCA] [In-order pipeline] Fix for 0 latency instruction causing assertion to fail. 2021-06-22 10:18:39 -07:00
Object [Object] make SourceMgr available to MCContext during inline asm symbols 2021-07-25 21:23:03 -07:00
ObjectYAML [yaml2obj][MachO] Rename PayloadString to Content 2021-07-26 09:04:51 -07:00
Option [OptTable] Rename PrintHelp to printHelp 2021-06-24 14:47:03 -07:00
Passes Add jump-threading optimization for deterministic finite automata 2021-07-27 14:34:04 -04:00
ProfileData [profile] Add binary id into profiles 2021-07-23 00:19:12 +00:00
Remarks
Support Build libSupport with -Werror=global-constructors (NFC) 2021-07-27 04:27:18 +00:00
TableGen DetailedRecordsBackend.cpp - printSectionHeading - avoid std::string creation/copies. 2021-06-13 16:49:40 +01:00
Target BPF: avoid NE/EQ loop exit condition 2021-08-06 12:45:53 -07:00
Testing Fix for error "'Run' overrides a member function but is not marked 2021-06-11 06:56:00 -07:00
TextAPI Reland "[llvm] llvm-tapi-diff" 2021-06-09 21:17:34 -07:00
ToolDrivers [OptTable] Rename PrintHelp to printHelp 2021-06-24 14:47:03 -07:00
Transforms [InstCombine] Fixed select + masked load fold failure 2021-08-06 12:41:06 -07:00
WindowsManifest
XRay [lib/Object, tools] - Make ELFObjectFile::getELFFile return reference. 2020-12-04 16:02:29 +03:00
CMakeLists.txt [DWP] Refactoring llvm-dwp in to a library part 2 2021-07-22 14:23:29 -07:00