mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
f6a86e448a
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) |
||
---|---|---|
.. | ||
AsmParser | ||
Disassembler | ||
MCTargetDesc | ||
TargetInfo | ||
BPF.h | ||
BPF.td | ||
BPFAbstractMemberAccess.cpp | ||
BPFAdjustOpt.cpp | ||
BPFAsmPrinter.cpp | ||
BPFCallingConv.td | ||
BPFCheckAndAdjustIR.cpp | ||
BPFCORE.h | ||
BPFFrameLowering.cpp | ||
BPFFrameLowering.h | ||
BPFInstrFormats.td | ||
BPFInstrInfo.cpp | ||
BPFInstrInfo.h | ||
BPFInstrInfo.td | ||
BPFISelDAGToDAG.cpp | ||
BPFISelLowering.cpp | ||
BPFISelLowering.h | ||
BPFMCInstLower.cpp | ||
BPFMCInstLower.h | ||
BPFMIChecking.cpp | ||
BPFMIPeephole.cpp | ||
BPFMISimplifyPatchable.cpp | ||
BPFPreserveDIType.cpp | ||
BPFRegisterInfo.cpp | ||
BPFRegisterInfo.h | ||
BPFRegisterInfo.td | ||
BPFSelectionDAGInfo.cpp | ||
BPFSelectionDAGInfo.h | ||
BPFSubtarget.cpp | ||
BPFSubtarget.h | ||
BPFTargetMachine.cpp | ||
BPFTargetMachine.h | ||
BPFTargetTransformInfo.h | ||
BTF.def | ||
BTF.h | ||
BTFDebug.cpp | ||
BTFDebug.h | ||
CMakeLists.txt |