llvm-project/llvm/test/CodeGen/BPF
Yonghong Song 3cb7e7bf95 BPF: fix a CORE optimization bug
For the test case in this patch like below
  struct t { int a; } __attribute__((preserve_access_index));
  int foo(void *);
  int test(struct t *arg) {
      long param[1];
      param[0] = (long)&arg->a;
      return foo(param);
  }

The IR right before BPF SimplifyPatchable phase:
  %1:gpr = LD_imm64 @"llvm.t:0:0$0:0"
  %2:gpr = LDD killed %1:gpr, 0
  %3:gpr = ADD_rr %0:gpr(tied-def 0), killed %2:gpr
  STD killed %3:gpr, %stack.0.param, 0
After SimplifyPatchable phase, the incorrect IR is generated:
  %1:gpr = LD_imm64 @"llvm.t:0:0$0:0"
  %3:gpr = ADD_rr %0:gpr(tied-def 0), killed %1:gpr
  CORE_MEM killed %3:gpr, 306, %0:gpr, @"llvm.t:0:0$0:0"

Note that CORE_MEM pseudo op is introduced to encode
memory operations related to CORE. In the above, we intend
to check whether we have a store like
   *(%3:gpr + 0) = ...
and if this is the case, we could replace it with
   *(%0:gpr + @"llvm.t:0:0$0:0"_ = ...

Unfortunately, in the above, IR for the store is
   *(%stack.0.param + 0) = %3:gpr
and transformation should not happen.

Note that we won't have problem if the actual CORE
dereference (arg->a) happens.

This patch fixed the problem by skip CORE optimization if
the use of ADD_rr result is not the base address of the store
operation.

Differential Revision: https://reviews.llvm.org/D78466
2020-04-20 19:54:51 -07:00
..
BTF [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs 2020-01-10 09:06:31 -08:00
CORE BPF: fix a CORE optimization bug 2020-04-20 19:54:51 -07:00
32-bit-subreg-alu.ll [BPF] turn on -mattr=+alu32 for cpu version v3 and later 2019-11-07 22:08:46 -08:00
32-bit-subreg-cond-select.ll [BPF] Fix a bug in peephole optimization 2019-11-20 15:19:59 -08:00
32-bit-subreg-load-store.ll
32-bit-subreg-peephole-phi-1.ll [BPF] Fix a bug in peephole optimization 2019-11-20 15:19:59 -08:00
32-bit-subreg-peephole-phi-2.ll [BPF] Fix a bug in peephole optimization 2019-11-20 15:19:59 -08:00
32-bit-subreg-peephole-phi-3.ll [BPF] Fix a recursion bug in BPF Peephole ZEXT optimization 2019-11-22 08:05:43 -08:00
32-bit-subreg-peephole.ll [BPF] Fix a bug in peephole optimization 2019-11-20 15:19:59 -08:00
alu8.ll
atomics.ll
basictest.ll
byval.ll
callx.ll [BPF] fix indirect call assembly code 2019-10-21 03:22:03 +00:00
cc_args.ll
cc_args_be.ll
cc_ret.ll
cmp.ll
dwarfdump.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
elf-symbol-information.ll
ex1.ll
fi_ri.ll
i128.ll [BPF] support 128bit int explicitly in layout spec 2020-03-28 11:46:29 -07:00
inline_asm.ll
inlineasm-output-template.ll
intrinsics.ll
is_trunc_free.ll [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering 2020-02-11 09:59:19 -08:00
is_zext_free.ll [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering 2020-02-11 09:59:19 -08:00
lit.local.cfg
load.ll
loops.ll
many_args1.ll
many_args2.ll
mem_offset.ll
mem_offset_be.ll
memcpy-expand-in-order.ll
objdump_atomics.ll
objdump_cond_op.ll [llvm-objdump] -d: print `00000000 <foo>:` instead of `00000000 foo:` 2020-03-05 18:05:28 -08:00
objdump_cond_op_2.ll [llvm-objdump] -d: print `00000000 <foo>:` instead of `00000000 foo:` 2020-03-05 18:05:28 -08:00
objdump_imm_hex.ll [test] llvm/test/: change llvm-objdump single-dash long options to double-dash options 2020-03-15 17:46:23 -07:00
objdump_intrinsics.ll
objdump_static_var.ll
objdump_trivial.ll
objdump_two_funcs.ll [llvm-objdump] -d: print `00000000 <foo>:` instead of `00000000 foo:` 2020-03-05 18:05:28 -08:00
optnone-1.ll [BPF] fix a bug in BPFMISimplifyPatchable pass with -O0 2020-01-30 08:28:39 -08:00
reloc-btf-2.ll [llvm-objdump] Print file format in lowercase to match GNU output. 2020-02-12 08:17:01 -08:00
reloc-btf.ll [llvm-objdump] Print file format in lowercase to match GNU output. 2020-02-12 08:17:01 -08:00
reloc.ll [llvm-objdump] Print file format in lowercase to match GNU output. 2020-02-12 08:17:01 -08: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 bpf: fix wrong truncation elimination when there is back-edge/loop 2019-10-16 15:27:59 +00:00
rodata_1.ll
rodata_2.ll
rodata_3.ll
rodata_4.ll [llvm] Fix missing FileCheck directive colons 2020-04-06 09:59:08 -06:00
sanity.ll
sdiv_error.ll Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""" 2020-02-13 10:16:06 -08:00
select_ri.ll
setcc.ll
shifts.ll [SelectionDAG] ComputeKnownBits - minimum leading/trailing zero bits in LSHR/SHL (PR44526) 2020-01-13 11:08:12 +00:00
sockex2.ll
struct_ret1.ll
struct_ret2.ll
undef.ll
vararg1.ll
warn-call.ll
warn-stack.ll Migrate function attribute "no-frame-pointer-elim" to "frame-pointer"="all" as cleanups after D56351 2019-12-24 15:57:33 -08:00
xadd.ll Revert "Revert "Reland "[Support] make report_fatal_error `abort` instead of `exit`""" 2020-02-13 10:16:06 -08:00
xadd_legal.ll