1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/CodeGen/BPF
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
..
BTF Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
CORE [BPF] Use elementtype attribute for preserve.array/struct.index intrinsics 2021-07-17 11:09:18 +02:00
32-bit-subreg-alu.ll
32-bit-subreg-cond-select.ll
32-bit-subreg-load-store.ll
32-bit-subreg-peephole-phi-1.ll
32-bit-subreg-peephole-phi-2.ll
32-bit-subreg-peephole-phi-3.ll
32-bit-subreg-peephole.ll
32-bit-subreg-zext.ll
adjust-opt-icmp1.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
adjust-opt-icmp2.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
adjust-opt-speculative1.ll [InstCombine] Fold (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C, Idx, 0)) (PR50183) (REAPPLIED) 2021-07-14 12:21:01 +01:00
adjust-opt-speculative2.ll [InstCombine] Fold (select C, (gep Ptr, Idx), Ptr) -> (gep Ptr, (select C, Idx, 0)) (PR50183) (REAPPLIED) 2021-07-14 12:21:01 +01:00
alu8.ll
atomics_2.ll
atomics.ll
basictest.ll
byval.ll
callx.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
cc_args_be.ll
cc_args.ll
cc_ret.ll
cmp.ll
dwarfdump.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
elf-symbol-information.ll
ex1.ll
fi_ri.ll
i128.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
inline_asm.ll
inlineasm-output-template.ll
inlineasm-wreg.ll [BPF] add support for 32 bit registers in inline asm 2021-05-16 11:01:47 -07:00
intrinsics.ll
is_trunc_free.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
is_zext_free.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
lit.local.cfg [BPF][Test] Disable codegen test on AIX 2021-05-06 02:38:46 +00:00
load.ll
loop-exit-cond.ll BPF: avoid NE/EQ loop exit condition 2021-08-06 12:45:53 -07:00
loops.ll
many_args1.ll
many_args2.ll
mem_offset_be.ll
mem_offset.ll
memcpy-expand-in-order.ll
objdump_atomics.ll
objdump_cond_op_2.ll
objdump_cond_op.ll
objdump_dis_all.ll
objdump_imm_hex.ll
objdump_intrinsics.ll
objdump_nop.ll
objdump_static_var.ll
objdump_trivial.ll
objdump_two_funcs.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
optnone-1.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
optnone-2.ll
reloc-2.ll BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
reloc-3.ll BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
reloc-btf-2.ll BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
reloc-btf.ll BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
reloc.ll BPF: Add more relocation kinds 2021-05-25 08:19:13 -07:00
remove_truncate_1.ll
remove_truncate_2.ll
remove_truncate_3.ll
remove_truncate_4.ll
remove_truncate_5.ll
remove_truncate_6.ll
remove_truncate_7.ll
remove_truncate_8.ll
rodata_1.ll
rodata_2.ll
rodata_3.ll
rodata_4.ll
rodata_5.ll
rodata_6.ll
rodata_7.ll
sanity.ll
sdiv_error.ll
select_ri.ll
selectiondag-bug.ll
setcc.ll
shifts.ll
simplifycfg.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
sockex2.ll
struct_ret1.ll
struct_ret2.ll
undef.ll
vararg1.ll
warn-call.ll
warn-stack.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
xadd_legal.ll
xadd.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00